Bug Fix
Balarama Bosch <[email protected]> Wed, 26 Oct 2005 15:07:31 -0500
| Newsgroups | gmane.comp.php.pear.liveuser |
|---|---|
| Message-ID | <[email protected]> |
Hi,
Found a bug that was annoying the hell out of me.
I was trying to add some custom logs through the conf array...
in LiveUser.php 0.16.7 line 679
function readConfig(&$conf)
{
// probably a futile attempt at working out reference issues in arrays
$options = $conf;
unset($options['debug']);
if (array_key_exists('debug', $conf) && is_object($conf['debug'])) {
$options['debug'] = true;
}
On line 682 a copy of $conf is made. The problem is that the references
are still the SAME references as in the original object. From a comment
in the PHP manual: On array copying a deep copy is done of elements
except those elements which are references, in which case the reference
is maintained. This is a very important thing to understand if you
intend on mixing references and recursive arrays.
To get around that, before you change the value of $options['debug'] you
need to unset it, so it won't change the referenced object.
So add under line 682:
unset($options['debug']);
Hope this helps.
Cheers,
Balarama Bosch