ID: 28832 Updated by: [EMAIL PROTECTED] Reported By: tomas_matousek at hotmail dot com -Status: Open +Status: Bogus -Bug Type: Scripting Engine problem +Bug Type: Zend Engine 2 problem Operating System: WinXP PHP Version: 5.0.0RC3 New Comment:
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php "Contains a reference to every variable which is currently available within the global scope of the script. The keys of this array are the names of the global variables." As of this, you're copying array of *references* to global variables. No wonder that you're still able to change them. That's expected behaviour. Previous Comments: ------------------------------------------------------------------------ [2005-01-25 09:30:57] barond0 at gmail dot com Is this possibly just the way globals work? I am having the same problem with PHP 4.3.8 running on Fedora. This is what I am trying: $GLOBALS['test']="info"; $a=$GLOBALS['test'] I expect $a to be "info," but it does not work ------------------------------------------------------------------------ [2004-06-18 17:00:41] tomas_matousek at hotmail dot com Description: ------------ When the operator = is used on user created array on RHS this array will be copied to LHS. But if $GLOBALS variable is used on RHS a copy is not made. It seems like it behaves as =& when used on $GLOBALS which is IMHO not correct. Reproduce code: --------------- $x = 1; $a = $GLOBALS; $a["x"] = 2; echo $x; Expected result: ---------------- 1 Actual result: -------------- 2 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=28832&edit=1
