Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Page 1 of 4
Magento PHP 5.3
 
Ryan Showers
Jr. Member
 
Total Posts:  10
Joined:  2008-09-18
 

Due to some changes with PHP’s magic methods (so far it’s been __toString()), Magento won’t work out of the box with PHP 5.3.
(i.e. Fatal error: Method Varien_Object::__tostring() cannot take arguments in /magento/lib/Varien/Object.php on line 488)

See http://wiki.php.net/doc/scratchpad/upgrade/53

5.3 is scheduled to be released mid-October.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Anjanesh
Sr. Member
 
Avatar
Total Posts:  136
Joined:  2008-03-15
Mumbai, India
 

Is there a quick fix for this ?

 
Magento Community Magento Community
Magento Community
Magento Community
 
niaxilin
Member
 
Avatar
Total Posts:  64
Joined:  2009-05-19
Minneapolis, Minnesota
 

Yes...this will get interesting. Here are the PHP 5.3 Release Notes:
http://www.php.net/manual/en/migration53.incompatible.php

Doing a quick grep search, I found these two lines of code passing arguments into __toString()…

app/code/core/Mage/Catalog/Model/Layer/Filter/Price.php:139: $key.= $taxReq->__toString(array(), ‘_’);
lib/Varien/Object.php:484: public function __toString(array $arrAttributes = array(), $valueSeparator=’,’)

 
Magento Community Magento Community
Magento Community
Magento Community
 
niaxilin
Member
 
Avatar
Total Posts:  64
Joined:  2009-05-19
Minneapolis, Minnesota
 

A bug/issue report closed by Varien:
http://www.magentocommerce.com/bug-tracking/issue?issue=4841

A thread from August 08:
http://www.magentocommerce.com/boards/viewthread/15328/

A longer thread in January (with fix?):
http://www.magentocommerce.com/boards/viewthread/29670/

 
Magento Community Magento Community
Magento Community
Magento Community
 
Phil Freo
Jr. Member
 
Avatar
Total Posts:  18
Joined:  2008-05-06
Jacksonville, FL
 

Another bug report about it: http://www.magentocommerce.com/bug-tracking/issue/?issue=6662
This one is currently “assigned”

 
Magento Community Magento Community
Magento Community
Magento Community
 
Luca Candela
Jr. Member
 
Total Posts:  1
Joined:  2009-06-16
 

Any news about PHP 5.3 compatibility yet?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Paulo B
Jr. Member
 
Total Posts:  14
Joined:  2009-07-25
 

Any news about PHP 5.3 compatibility yet?

Currently status of issue reported for you: resolved. See here.

But, where’s the solution package?

 
Magento Community Magento Community
Magento Community
Magento Community
 
naujasdizainas
Sr. Member
 
Avatar
Total Posts:  128
Joined:  2007-11-04
Lithuania, Vilnius
 
Phil Freo - 03 July 2009 09:03 AM

Another bug report about it: http://www.magentocommerce.com/bug-tracking/issue/?issue=6662
This one is currently “assigned”

does not the whole code, but try to change in file /lib/Varien/Object.php on line ~ 484

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

To this (change ___toString to __invoke

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

And in file /app/code/core/Mage/Core/Controller/Request/Http.php on line 274

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

to

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

split to explode

 
Magento Community Magento Community
Magento Community
Magento Community
 
naujasdizainas
Sr. Member
 
Avatar
Total Posts:  128
Joined:  2007-11-04
Lithuania, Vilnius
 

And where is split() try change to explode() example:

in file /home/masazoprekes/masazoprekes.lt/app/code/core/Mage/Admin/Model/User.php on line 374

Maybe another have more experience in the magnet core code .....

 
Magento Community Magento Community
Magento Community
Magento Community
 
Artyom4D
Jr. Member
 
Total Posts:  1
Joined:  2008-10-06
 

Thanks a lot! All works now. Another we disable depricated in php.ini file

 
Magento Community Magento Community
Magento Community
Magento Community
 
HAL10001
Member
 
Avatar
Total Posts:  52
Joined:  2008-06-02
Ann Arbor, MI
 

I find it both frustrating and a poor development practice to require PHP v5.2, and yet have bugs in the code for a stable release of v5.3 that obviously were not tested. Seriously, I run most installations of Magento on CentOS 5, which as an install by default uses v5.1.6. Using a Remi repo to install the latest version gets you to v5.3. It’s obvious that the benchmarking practices for Varien need to change.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Raptor Commerce (Matt)
Member
 
Total Posts:  49
Joined:  2009-08-10
 
HAL10001 - 10 August 2009 05:39 AM

I find it both frustrating and a poor development practice to require PHP v5.2, and yet have bugs in the code for a stable release of v5.3 that obviously were not tested. Seriously, I run most installations of Magento on CentOS 5, which as an install by default uses v5.1.6. Using a Remi repo to install the latest version gets you to v5.3. It’s obvious that the benchmarking practices for Varien need to change.

To be fair to Varien the system requirements state php 5.2, not 5.1.6 or 5.3.

Matt

 
Magento Community Magento Community
Magento Community
Magento Community
 
HAL10001
Member
 
Avatar
Total Posts:  52
Joined:  2008-06-02
Ann Arbor, MI
 
HAL10001 - 10 August 2009 05:39 AM

I find it both frustrating and a poor development practice to require PHP v5.2, and yet have bugs in the code for a stable release of v5.3 that obviously were not tested. Seriously, I run most installations of Magento on CentOS 5, which as an install by default uses v5.1.6. Using a Remi repo to install the latest version gets you to v5.3. It’s obvious that the benchmarking practices for Varien need to change.

You will also need to change app/code/core/Mage/Admin/Model.php… from split to explode in functions that use it. I only found one place that threw an error in that file so far.

 
Magento Community Magento Community
Magento Community
Magento Community
 
HAL10001
Member
 
Avatar
Total Posts:  52
Joined:  2008-06-02
Ann Arbor, MI
 
mattwilliams - 10 August 2009 06:34 AM

HAL10001 - 10 August 2009 05:39 AM
I find it both frustrating and a poor development practice to require PHP v5.2, and yet have bugs in the code for a stable release of v5.3 that obviously were not tested. Seriously, I run most installations of Magento on CentOS 5, which as an install by default uses v5.1.6. Using a Remi repo to install the latest version gets you to v5.3. It’s obvious that the benchmarking practices for Varien need to change.

To be fair to Varien the system requirements state php 5.2, not 5.1.6 or 5.3.

Matt

You’re talking about building an enterprise version dependent upon minor release features. If you’re doing that on a consistent basis, then you’re going to experience issues down the road. This isn’t the difference between 4 and 5, but the difference between 5.2 and 5.3. They did set expectations by stating that 5.2 is a requirement, but as I said, this could continually cause problems with each minor release of PHP.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Raptor Commerce (Matt)
Member
 
Total Posts:  49
Joined:  2009-08-10
 
HAL10001 - 10 August 2009 07:23 AM

mattwilliams - 10 August 2009 06:34 AM
HAL10001 - 10 August 2009 05:39 AM
I find it both frustrating and a poor development practice to require PHP v5.2, and yet have bugs in the code for a stable release of v5.3 that obviously were not tested. Seriously, I run most installations of Magento on CentOS 5, which as an install by default uses v5.1.6. Using a Remi repo to install the latest version gets you to v5.3. It’s obvious that the benchmarking practices for Varien need to change.

To be fair to Varien the system requirements state php 5.2, not 5.1.6 or 5.3.

Matt

You’re talking about building an enterprise version dependent upon minor release features. If you’re doing that on a consistent basis, then you’re going to experience issues down the road. This isn’t the difference between 4 and 5, but the difference between 5.2 and 5.3. They did set expectations by stating that 5.2 is a requirement, but as I said, this could continually cause problems with each minor release of PHP.

Yeah but no vendor can warrant that their code will work against an api if the contract changes. The problem actually lies with the PHP maintainers who have changed the programming contract during a minor version upgrade e.g.

‘The __toString magic method can no longer accept arguments.’

A minor version upgrade should only consist of changes to the implementation of the api, not the external interface. Stuff like this makes me realize that PHP is still a long way behind Java/.NET in the enterprise arena :-(

 
Magento Community Magento Community
Magento Community
Magento Community
 
firewizard
Member
 
Avatar
Total Posts:  43
Joined:  2007-11-22
Bucharest, Romania
 

changing __toString to __invoke won’t solve the entire problem. __toString is being directly called thus the need to either catch it in __call or declare it.

function __toString() {
        
return $this->__invokefunc_get_arg(0), func_get_arg(1) );
    
}

This minor php upgrade is very upsetting, considering the changes are quite major. Let’s hope next Magento release will be php 5.3 compatible and well prepared for the upcoming php 6.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top
Page 1 of 4