Make Magento 1.4 work with PHP 5.3+

Tweet, share & co

tweet fb share g+ share

Tags


Description

Magento versions prior to 1.4 are not compatible with PHP 5.3, resulting in errors. The problem is that older version of Magento used some functions which were deprecated in PHP 5.3.

Code

// In file lib/Varien/Object.php (line 484), replace
public function __toString(array $arrAttributes = array(), $valueSeparator=',')
// by
public function __invoke(array $arrAttributes = array(), $valueSeparator=',')

// In file app/code/core/Mage/Catalog/Model/Layer/Filter/Price.php (line 139), replace
$key.= $taxReq->__toString(array(), '_');
// by
$key.= $taxReq->__invoke(array(), '_');

// In file lib/Zend/Pdf/Resource/Image/Jpeg.php (line 59), replace
if (!$gd_options['JPG Support'] ) {
// by
if ( (!isset($gd_options['JPG Support']) || $gd_options['JPG Support'] != true) &&
(!isset($gd_options['JPEG Support']) || $gd_options['JPEG Support'] != true) ) {

// In the following files:
// index.php
// downloader/index.php
// downloader/Maged/Pear.php
// lib/Varien/Pear.php
// replace:
error_reporting(E_ALL | E_STRICT);
// by
error_reporting(E_ALL & E_STRICT & ~E_DEPRECATED);

Comments