#28832 [Com]: Operator = doesn't copy $GLOBALS array
| From: | barond0 at gmail dot com | Date: | Tue, 25 Jan 2005 08:30:57 +0000 |
| Subject: | #28832 [Com]: Operator = doesn't copy $GLOBALS array | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-72773@lists.php.net to get a copy of this message | ||
ID: 28832
Comment by: barond0 at gmail dot com
Reported By: tomas_matousek at hotmail dot com
Status: Open
Bug Type: Scripting Engine problem
Operating System: WinXP
PHP Version: 5.0.0RC3
New Comment:
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
Previous Comments:
------------------------------------------------------------------------
[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