Ads

How to fix Magento on PHP 5.3

November 27, 2009
Filed under: Featured, Magento Cart, PHP, Shopping Carts, eCommerce 

We got this project when our server is newly loaded with PHP 5.3.

Here is the Fix:

To get it working in php5.3 seems to be quite simple as the offending part of the __toString function seems to be only used by one object:
app/code/core/Mage/Catalog/Model/Layer/Filter/Price.php which calls the function with the defaults anyway.
in /lib/Varien/Object.php line 484 replace:

public function __toString(array $arrAttributes = array(), $valueSeparator=',')
{
$arrData = $this->toArray($arrAttributes);
return implode($valueSeparator, $arrData);
}

with

public function __toString()
    {
        $arrData = $this->toArray();
        return implode(',', $arrData);
    } 

You also need to change app/code/core/Mage/Catalog/Model/Layer/Filter/Price.php line 139 (untested) to:

$key.= implode('_', $taxReq->_data);



The next thing to contend with is that split() is now depricated and there is a new error constant which Magento does not (yet) recognise. To ignore the error edit the file app/code/core/Mage/Core/functions.php after line 170 add :

if ($errno == 8192) {
        return false;
    }

You’ll also need to ensure that index.php has the line:
ini_set(’display_errors’, 0);

Don’t know if any other issues arise but this has got it setup for me and so I can carry on evaluating whether we use this or not.

You can find a clear details in the following posts.

http://www.magentocommerce.com/boards/viewthread/29670/ (Solution is taken from this).

http://www.magentocommerce.com/boards/appserv/main.php/viewthread/18080/#t162945

Comments

One Comment on How to fix Magento on PHP 5.3

  1. PHP5.3 is coming | TerraNetwork on Mon, 14th Mar 2011 12:28 pm
  2. [...] since version 1.4.0. Older 1.3.x version are not compatible, for these the fixes outlined blog.theunical.com/ecommerce/shopping-carts/magento-cart/how-to-fix-magento-on-php-5-3/ are required, or the site needs to be upgraded to [...]

Tell me what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!





*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word

Subscribe without commenting