Edit report at https://bugs.php.net/bug.php?id=69300&edit=1

 ID:                 69300
 Updated by:         c...@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

-- 
PHP Quality Assurance Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to