Archive for December 2011
Running Magento 1.3 on PHP 5.3
Magento 1.3 is not compatible with PHP 5.3 without any additional modifications. So if you decide to run Magento with PHP 5.3, here is a two-step description how to do it:
1) Open index.php and locate the line containing :
error_reporting(E_ALL | E_STRICT);
It is the 35th line in Magento 1.3.3.0. Replace it with :
error_reporting((E_ALL | E_STRICT) & !E_DEPRECATED);
In PHP 5.3 functions like split() and ereg() are deprecated. Magento 1.3 widely uses these two functions so you have to disable error reporting for the newly introduced error level E_DEPRECATED.
2) Open lib/Varien/Object.php and look for the method :
public function __toString(array $arrAttributes = array(), $valueSeparator=’,')
{
$arrData = $this->toArray($arrAttributes);
return implode($valueSeparator, $arrData);
}
It is line 484 in Magento 1.3.3.0. Replace it with
public function __toString()
{
if(func_num_args() > 0) {
$arrAttributes = func_get_arg(0);
} else {
$arrAttributes = array();
}
if(func_num_args() > 1) {
$valueSeparator = func_get_arg(1);
} else {
$valueSeparator = ‘,’;
}
$arrData = $this->toArray($arrAttributes);
return implode($valueSeparator, $arrData);
}
With PHP 5.3 the magic method __toString() no more accepts any parameters. That’s why the old method declaration will cause the following error:
Fatal error: Method Varien_Object::__tostring() cannot take arguments in /magento/lib/Varien/Object.php
Note: The steps listed above are tested with Magento 1.3.3.0.