Bug #69300 [Opn->Nab]: $GLOBALS always assigned as reference variable.
| From: | cmb@php.net | Date: | Wed, 25 Mar 2015 20:15:06 +0000 |
| Subject: | Bug #69300 [Opn->Nab]: $GLOBALS always assigned as reference variable. | ||
| References: | 1 | Groups: | php.bugs php.qa |
| Request: | Send a blank email to php-bugs+get-191606@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=69300&edit=1
ID: 69300
Updated by: cmb@php.net
Reported by: sandeep dot singh dot bisht at gmail dot com
Summary: $GLOBALS always assigned as reference variable.
-Status: Open
+Status: Not a bug
Type: Bug
Package: Testing related
Operating System: Ubuntu
PHP Version: Irrelevant
Block user comment: N
Private report: N
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
The manual states:
| An associative array containing *references* to all variables
| which are currently defined in the global scope of the script.
(emphasis mine)
Previous Comments:
------------------------------------------------------------------------
[2015-03-25 19:45:44] sandeep dot singh dot bisht at gmail dot com
Description:
------------
---
From manual page: http://www.php.net/reserved.variables.globals
---
Test script:
---------------
<?php
#---------------------------------------------------------
#---First Normal case(GLOBAL variable assign to local variable)
#---------------------------------------------------------
$GLOBALS['abc']='123';
$test1=$GLOBALS;
$test1['abc']='1234';
echo $GLOBALS['abc']."\n"; #----------Output is 1234 Expecting 123
#--------------------------------------------------------------------
#---Function test case(Global variable assign into variable inside function)
#----------------------------------------------------------------------
test();
echo $GLOBALS['abc']."\n";#-----------Output is 0000 Expecting 123
function test()
{
$test=$GLOBALS;
$test['abc']='0000';
}
?>
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=69300&edit=1