Magento Fatal error: Method Varien_Object::__tostring() cannot take arguments

Posted by Damodar Bashyal on June 17, 2012

 

After I upgraded my php to 5.3 on my wamp, i got below error in my magento installation:

( ! ) SCREAM: Error suppression ignored for
( ! ) Fatal error: Method Varien_Object::__tostring() cannot take arguments in lib\Varien\Object.php on line 488
Call Stack
#	Time	Memory	Function	Location
1	0.0006	167808	{main}( )	..\index.php:0
2	0.0081	360392	Mage::run( )	..\index.php:68
3	0.0081	362544	Mage::app( )	..\Mage.php:455
4	0.0189	803120	Mage_Core_Model_Config->__construct( )	..\Mage.php:430
5	0.0189	803464	Varien_Autoload->autoload( )	..\Mage.php:0
6	0.0198	835440	include( 'app\code\core\Mage\Core\Model\Config\Options.php' )	..\Autoload.php:93
7	0.0198	835648	Varien_Autoload->autoload( )	..\Autoload.php:0

There is easy fix for this:

Open lib/Varien/Object.php and look for below code in around line 484

public function __toString(array $arrAttributes = array(),
$valueSeparator=',')

Replace it with:

public function  __invoke(array  $arrAttributes = array(),
$valueSeparator=',')

Also, if you get Split deprecation error:

Open app/code/core/Mage/Core/Controller/Request/Http.php and look for below code in around line 199

$host = split(':', $_SERVER['HTTP_HOST']);

and replace with

$host = explode(':', $_SERVER['HTTP_HOST']);

Also change split to explode at: line 374 app\code\core\Mage\Admin\Model\User.php

Split has been DEPRECATED since PHP 5.3.0.

 
not published on website


QR Code: Magento Fatal error: Method Varien_Object::__tostring() cannot take arguments