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

Request #5669 new singleton could preserve BC
Submitted: 2005-10-12 08:30 UTC
From: jeroen at terena dot nl Assigned: lsmith
Status: Closed Package: LiveUser
PHP Version: 5.0.5 OS: debian
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 : 27 - 26 = ?

 
 [2005-10-12 08:30 UTC] jeroen at terena dot nl
Description: ------------ Moving from 0.16.6 to 0.16.7 breaks BC in the singleton method Test script: --------------- $lu = Liveuser::singleton($conf) does not return an instance anymore I think you could do this by changing the method slightly: function &singleton(&$conf, $signature = null) { static $instances; if (!isset($instances)) { $instances = array(); } if (is_null($signature)) { if (empty($instances)) { $signature = uniqid(); //or some other default string } else { $signature = key($instances); } } elseif (!array_key_exists($signature, $instances)) { $instances[$signature] =& LiveUser::factory($conf); } return $instances[$signature]; } This would create a default signature and I think BC could be preserved this way. Expected result: ---------------- Liveuser object returned Actual result: -------------- returns false

Comments

 [2005-10-12 16:51 UTC] lsmith
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.