Home » Authentication » LiveUser » Bug #5905
LiveUser::singleton() doesn't return object
Details
| Submitted | 2005-11-09 16:06 UTC |
|---|---|
| From | c dot weyland at gmx dot de |
| Assigned | lsmith |
| Status | Closed |
| Package | LiveUser |
| PHP Version | 4.3.10 |
| OS | Linux |
| Roadmaps | (Not assigned) |
Comments
[2005-11-09 16:06 UTC] c dot weyland at gmx dot de
Description:
------------
example5 even doesn't work with the latest CVS Version (LiveUser.php,v 1.120 2005/11/08) because
- uniqid is called without mandatory parameter
- no instance is returned at all
changing the code to the folliwing worked for me (not intensively tested!):
function &singleton(&$conf, $signature = null)
{
static $instances;
if (!isset($instances)) {
$instances = array();
}
if (is_null($signature)) {
if (empty($instances)) {
$signature = uniqid(rand());
} else {
$signature = key($instances);
}
}
if (!array_key_exists($signature, $instances)) {
$instances[$signature] =& LiveUser::factory($conf);
}
return $instances[$signature];
}
[2005-11-09 17:37 UTC] c dot weyland at gmx dot de
no, it is not a dupe because i am using the latest cvs version of LiveUser.php and thus using the code that was meant to fix the original bug.
As you can see at [1] uniqid() is being called without any argument.
[1] http://cvs.php.net/co.php/pear/LiveUser/LiveUser.php