ID:               24910
 Updated by:       [EMAIL PROTECTED]
 Reported By:      greg at chiaraquartet dot net
 Status:           Open
 Bug Type:         Arrays related
 Operating System: Windows XP
 PHP Version:      4.3.2
 New Comment:

an interesting thing: the following code does work as expected. 
Perhaps the index is not set unless $GLOBALS is accessed globally?

function not_super()
{
//    var_dump($GLOBALS['GLOBALS']);
    var_dump(isset($GLOBALS['GLOBALS']));
    $a = array_keys($GLOBALS);
    
    var_dump(isset($a['GLOBALS']));
}
not_super();
//    var_dump(isset($GLOBALS['GLOBALS']));
    $a = array_keys($GLOBALS);
    
//    var_dump(isset($a['GLOBALS']));



Previous Comments:
------------------------------------------------------------------------

[2003-08-01 15:32:34] [EMAIL PROTECTED]

This is not bogus.  Did you try the code?  The whole point is that in a
function, $GLOBALS['GLOBALS'] !== $GLOBALS.  It should be the same.

In global scope, $GLOBALS['GLOBALS'] === $GLOBALS

Greg

------------------------------------------------------------------------

[2003-08-01 15:23:54] [EMAIL PROTECTED]

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

$GLOBALS['GLOBALS'] is actually a reference to $GLOBALS if you want to
access the globals just use $GLOBALS.

------------------------------------------------------------------------

[2003-08-01 14:47:52] greg at chiaraquartet dot net

Description:
------------
the $GLOBALS variables contains indexes to every superglobal except
'GLOBALS' in function scope.  In global scope, it contains the
'GLOBALS' index as a self-reference

Reproduce code:
---------------
<?php 
function blah() {
  var_dump($GLOBALS['GLOBALS']);

}
blah();
?>

Expected result:
----------------
var_dump() of the $GLOBALS superglobal

Actual result:
--------------
Notice: Undefined index: GLOBALS in c:\web pages\chiara\a1.php on line
3
NULL


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=24910&edit=1

Reply via email to