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

Bug #9241 call_user_func_array: $this instaed of &$this
Submitted: 2006-11-06 11:14 UTC
From: joliver at gmx dot at Assigned: aashley
Status: Closed Package: Auth (version 1.4.1)
PHP Version: 4.3.10 OS: Debian stable
Roadmaps: (Not assigned)    
Subscription  


 [2006-11-06 11:14 UTC] joliver at gmx dot at (Oliver Jusinger)
Description: ------------ Auth.class, row 494: in call_user_func_array, the array of parameters contain $this as reference to the auth object. however this only works with php5, because in php4 a copy of the object is passed instead of the pointer. the correct solution would be call_user_func_array($this->loginCallback, array($this->username, &$this)); the code contains lots of similar lines, i would suggest to replace $this with &$this everywhere. Test script: --------------- Auth.class, row 494: call_user_func_array('additionalChecks', array($this->username, &$this)); function additionalChecks($username, &$auth) { if ($username == 'test') { $auth->logout(); } } Expected result: ---------------- In Auth.php $this->username should be empty, because of logout(); So later it should call loginFunction again. This only works in php5 or if &$this is passed to the array function in call_user_func_array

Comments

 [2006-11-10 01:12 UTC] aashley at php dot net (Adam Ashley)
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.