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  


 [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] 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!