note 81892 added to language.references.unset

From: Date: Tue, 18 Mar 2008 09:10:59 +0000
Subject: note 81892 added to language.references.unset
Groups: php.notes 
Request: Send a blank email to php-notes+get-137158@lists.php.net to get a copy of this message
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 ---- Server IP: 195.54.192.44 Probable Submitter: 89.31.118.254 ---- Manual Page -- http://www.php.net/manual/en/language.references.unset.php Edit -- https://master.php.net/note/edit/81892 Del: integrated -- https://master.php.net/note/delete/81892/integrated Del: useless -- https://master.php.net/note/delete/81892/useless Del: bad code -- https://master.php.net/note/delete/81892/bad+code Del: spam -- https://master.php.net/note/delete/81892/spam Del: non-english -- https://master.php.net/note/delete/81892/non-english Del: in docs -- https://master.php.net/note/delete/81892/in+docs Del: other reasons-- https://master.php.net/note/delete/81892 Reject -- https://master.php.net/note/reject/81892 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#137158) next »