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

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


 [2004-02-21 21:21 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/System_Command/Command.php' : /php/pear/System_Command/Command.php(179): $this = PEAR::raiseError(null, SYSTEM_COMMAND_NO_SHELL, null, E_USER_WARNING, null, 'System_Command_Error', true); /php/pear/System_Command/Command.php(187): $this = PEAR::raiseError(null, SYSTEM_COMMAND_TMPDIR_ERROR, null, E_USER_WARNING, null, 'System_Command_Error', true); 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-04-27 01:35 UTC] cardoe at cardoe dot com
Please fix this... Very annoying... :(
 [2004-07-01 07:25 UTC] jausions
I wrote a patch for this: You can download it at http://www.11abacus.com/cvs/pear/System_Command.patch The patch also make use of the better System::which() method. -Philippe
 [2004-07-11 22:49 UTC] gurugeek
Dear Maintainer, Your system command has currently 1 open bug. We urge you to take the necessary steps to solve the reported issues at your soonest convenience. If the bug issue hasn’t been addressed yet you are kindly asked to take the necessary steps to ensure a prompt resolution of the problem. If you already addressed the reported problem feel free to change the bug status as soon as possible. Regards David Costa PEAR Quality Assurance pear-qa@lists.php.net
 [2005-06-04 17:47 UTC] tacker
The supplied patch does not work with 1.0.1's Command.php The fixed version can be found here: http://m.tacker.org/projects/PEAR/System/System_Command-1.0.1.patch
 [2005-09-01 12:51 UTC] arnaud
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better. I just applied the patch, will look at the rest of the bugs list.