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

Bug #822 Assignment to $this
Submitted: 2004-02-21 21:05 UTC
From: pear-qa at lists dot php dot net Assigned: gurugeek
Status: Closed Package: Net_Curl
PHP Version: 5.0.0b4 (beta4) OS: Irrelevant
Roadmaps: (Not assigned)    

 [2004-02-21 21:05 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 . With kind regards, PEAR QA Team [1] Reproduce code: --------------- Affected are constructs like: FILE: '/php/pear/Net_Curl/Net/Curl.php' : /php/pear/Net_Curl/Net/Curl.php(251): $this = new PEAR_Error("Couldn't initialize a new curl handle"); 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 }


 [2004-05-10 08:59 UTC] gurugeek
Thank you for your bug report. This issue has been fixed in the latest released version of the package, which you can download at Fixed in release 1.0.1beta