Bugfix - PHP Fatal error: Method Varien_Object::__tostring() cannot take arguments in lib/Varien/Object.php on line 488

If you get the following error message in your Apache error_log, and you are running an old version of Magento (such as 1.3.2.4), then your version of Magento is probably incompatible with the version of PHP (such as 5.3+):

PHP Fatal error:  Method Varien_Object::__tostring() cannot take arguments in lib/Varien/Object.php on line 488
As a workaround, you need to change a few files. Please note that this is notnecessarilyan exhaustive list:
1) Edit lib/Varien/Object.php (Line 484)
Change
public function ___toString(array $arrAttributes = array(), $valueSeparator=',')
To
public function __invoke(array $arrAttributes = array(), $valueSeparator=',')
2) Edit app/code/core/Mage/Core/Controller/Request/Http.php (Line 274)
Change
$host = split(':', $_SERVER['HTTP_HOST']);
To
$host = explode(':', $_SERVER['HTTP_HOST']);
3) Edit app/code/core/Mage/Admin/Model/User.php (Line 374)
Change
$nodePath = 'adminhtml/menu/' . join('/children/', split('/', $startupPage)) . '/action';
To
$nodePath = 'adminhtml/menu/' . join('/children/', explode('/', $startupPage)) . '/action';
4) Editapp/code/core/Mage/Adminhtml/controllers/System/ConfigController.php (Line 154)
Change
foreach(split("\n", $e->getMessage()) as $message) {
To
foreach(explode("\n", $e->getMessage()) as $message) {
5) Editapp/code/core/Mage/Adminhtml/Model/System/Config/Backend/Locale.php (Line 49)
Change
$values   = split(',', $this->getValue());
To
$values   = explode(',', $this->getValue());
6) Edit /var/www/vhosts/example.co.nz/httpdocs/app/code/core/Mage/CatalogIndex/Model/Aggregation.php (Line 154 and line 159)
Change
$tagInfo = split(':', $tag);
To
$tagInfo = explode(':', $tag);
And Change
$tagVariants = split('/', $tagInfo[1]);
To
$tagVariants = explode('/', $tagInfo[1]);
If you are a Create Hosting customer with a Magento Optimised VPS, feel free to submit a support ticket and we can take care of this issue for you.
  • 88 Users Found This Useful
Was this answer helpful?

Related Articles

Bugfix - Warning: Invalid argument supplied for foreach() in app/code/core/Mage/Rule/Model/Condition/Abstract.php on line 246

This error is thrown when editing coupons (where SKU as one of the conditions) in Promotions >...

Error - Cannot edit customers / Cannot load configuration for payment method "amazonpayments_asp" after upgrading to 1.4.2.0

After upgrading to Magento 1.4.2.0, you may experience dificulty in editing customer information...

Bugfix - Magento 1.4.2.0 search not working properly / showing same results for all searches

If you are having problems with your search after upgrading to 1.4.2.0, ensure that you have...

Troubleshooting: XML declaration allowed only at the start of the document

This issue can often be seen in the var/log/system.log when an xml document has some issues....