note 81892 deleted from language.references.unset by nlopess
| From: | nlopess@php.net | Date: | Tue, 18 Mar 2008 19:31:22 +0000 |
| Subject: | note 81892 deleted from language.references.unset by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-137172@lists.php.net to get a copy of this message | ||
Note Submitter: anton (a) zebooka.com
----
It seems that there is a bug in PHP 5.1.6
I've written my own ErrorHandler. It receives $vars variable with all local variables. If error
occurs in global scope (in main script file and not in function or class) then $vars contains also
$GLOBALS and i can't unset it from $vars.
IT ALSO AFFECTS $GLOBALS ! Why? Documentation say it shouldn't.
if (isset($vars['GLOBALS']))
{
unset($vars['GLOBALS']);
$vars['GLOBALS'] = 'foo bar';
}
var_dump($vars['GLOBALS'], '----------------', $GLOBALS);
// Outputs 'foo bar' for both variables
BUT! If i do this by myself it works as expected.
$a['GLOBALS'] = &$GLOBALS;
unset($a['GLOBALS']);
$a['GLOBALS'] = 'foo bar';
var_dump($a['GLOBALS'], '----------------', $GLOBALS);
// Outputs 'foo bar' for $a and content of $GLOBALS for $GLOBALS