So, you still have your website in Magento 1.3.X because it has too
many customizations and you can’t upgrade, but you decide to upgrade to
PHP 5.3.X due to the annoyingness from PCI with the compliance changing
every hour and when you are going to check your website… a strange error
appears due to some PHP functions being deprecated? Yes, it happens to
many of us, but fortunately, here is a solution!
So, when you try to run your website, you get something like this:
Well, basically what’s happening is that some functions go deprecated
from PHP 5.2.X to 5.3.X and these are present in Magento 1.3.X (but not
in Magento 1.4.X).
The solution is a quick fix that involves just 3 files:
Open the file lib/Varien/Object.php, and do the following change:
Look for the line:
Change it to:
Now, go to the file: app\code\core\Mage\Core\Controller\Request\Http.php and change:
Look for the line:
Change it to:
Also, go to app\code\core\Mage\Catalog\Model\Category\Attribute\Backend\Sortby.php and change:
Look for the line:
Replace With:
Finally, open the file: app\code\core\Mage\Admin\Model\User.php and change:
Look for the line:
Replace With:
That’s it, you Magento environment should run again.
So, when you try to run your website, you get something like this:
Unknown error (8192): Function split() is deprecated in /app/code/core/Mage/Admin/Model/User.php on line 374
Trace:
#0 [internal function]: mageCoreErrorHandler(8192, ‘Function split(…’, ‘ /app/code/core/Mage/…’, 374, Array)
#1 /app/code/core/Mage/Admin/Model/User.php(374): split()
#2 /app/code/core/Mage/Adminhtml/controllers/IndexController.php(42): Mage_Admin_Model_User->getStartupPageUrl()
#3 /app/code/core/Mage/Core/Controller/Varien/Action.php(376): Mage_Adminhtml_IndexController->indexAction()
#4
/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(248):
Mage_Core_Controller_Varien_Action->dispatch(’index’)
#5 /app/code/core/Mage/Core/Controller/Varien/Front.php(158):
Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#6 /app/Mage.php(459): Mage_Core_Controller_Varien_Front->dispatch()
#7 /index.php(65): Mage::run()
#8 {main}
|
The solution is a quick fix that involves just 3 files:
Open the file lib/Varien/Object.php, and do the following change:
Look for the line:
public function ___toString(array $arrAttributes = array(), $valueSeparator=’,’)
|
public function __invoke(array $arrAttributes = array(), $valueSeparator=’,’)
|
Now, go to the file: app\code\core\Mage\Core\Controller\Request\Http.php and change:
Look for the line:
$host = split(‘:’, $_SERVER['HTTP_HOST']);
|
$host = explode(‘:’, $_SERVER['HTTP_HOST']);
|
Also, go to app\code\core\Mage\Catalog\Model\Category\Attribute\Backend\Sortby.php and change:
Look for the line:
$object->setData($attributeCode, split(‘,’, $data));
|
$object->setData($attributeCode, explode(‘,’, $data));
|
Finally, open the file: app\code\core\Mage\Admin\Model\User.php and change:
Look for the line:
$nodePath = ‘adminhtml/menu/’ . join(‘/children/’, split(‘/’, $startupPage)) . ‘/action’;
|
$nodePath = ‘adminhtml/menu/’ . join(‘/children/’, explode(‘/’, $startupPage)) . ‘/action’;
|
That’s it, you Magento environment should run again.
No comments:
Post a Comment