Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.2.4

Bug #831 Assignment to $this
Submitted: 2004-02-21 21:29 UTC
From: pear-qa at lists dot php dot net Assigned: dallen
Status: Closed Package: XML_XPath
PHP Version: 5.0.0b4 (beta4) OS: Irrelevant
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 11 + 10 = ?

 
 [2004-02-21 21:29 UTC] pear-qa at lists dot php dot net
Description: ------------ ## from the PEAR QA team ## ## quality-assurance related ## ## PHP 5 compatibility issue ## Dear package maintainer, your package makes use of the assignement of new values to $this. This methodis possible in PHP 4 but will throw an error with PHP 5 [1]. Please take care of this issue forPHP5 compatibility reasons. Please answer to this bugreport directly through the PEAR bug tracker or the mailinglist pear-qa@lists.php.net . With kind regards, PEAR QA Team [1] http://www.php.net/ChangeLog-5.php#5.0.0b4 Reproduce code: --------------- FILE: '/php/pear/XML_XPath/XPath.php' : /php/pear/XML_XPath/XPath.php(101): $this = $result; /php/pear/XML_XPath/XPath.php(276): $this = null; FILE: '/php/pear/XML_XPath/XPath/result.php' : /php/pear/XML_XPath/XPath/result.php(508): $this = null; Expected result: ---------------- Solutions: The assignment to $this occurs mostly inside constructors (<Your_Package_Name>()). You should provide an static factory() or singleton() method for this. To provide backwards compatibility you should work around the affected code pieces. This can be done by a version check: if (version_compare(phpversion(), "5.0.0") == -1) { // assign factoried method to this for PHP 4 // $this =& <Your_Package_Name>::factory(); $this =& <Your_Package_Name>::singleton(); } else { // error handling for PHP5 // user has to use the factory()/singleton() method }

Comments

 [2004-07-11 22:57 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2005-05-11 12:14 UTC] amol_dhormale at yahoo dot co dot in
Dear package maintainer, The package XML_XPath makes use of the assignement of new values to $this. This methodis possible in PHP 4 but will throw an error with PHP 5 . The same bug was there in phpDocumentor but now it's been solved in 1.3.10 version. Please try to fix this. With kind regards, Amol Dhormale
 [2005-10-12 16:12 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!