Posts tagged with “fix”

PHP 5.3 and Magento

Thursday, 10 September, 2009

magento ecommerceI was installing Magento version 1.3.2.1 on a XAMPP version 1.7.2 instalation for a friend, and I got an error on the very beginning of the installation:

Fatal error: Method Varien_Object::__tostring() cannot take arguments in /magento/lib/Varien/Object.php

With a small research I found out that there is a known issue with Magento and the PHP 5.3. Not a problem though, the solution was only 2 lines of code away. More specifically:

On the file /lib/Varien/Object.php (Line 484)

Change this:

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

To that:

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

and on the file /app/code/core/Mage/Core/Controller/Request/Http.php (Line 274)

Change this:

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

To that:

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

And you should be ok. Unfortunately I kept having problems, since the XAMPP instalation was a bit slow and it kept giving me a timeout in the middle of the database installation. Oh well, I keep telling my friends to set up a Linux server, they never listen…