Edit report at http://bugs.php.net/bug.php?id=29176&edit=1
ID: 29176
Comment by: php at caves dot org dot uk
Reported by: webmaster at ragnarokonline dot de
Summary: $GLOBALS['_REQUEST'], $GLOBALS['_ENV'] AND
$GLOBALS['_SERVER'] are empty
Status: Wont fix
Type: Bug
Package: Variables related
Operating System: All
PHP Version: 5.0.0
Assigned To: sesser
New Comment:
Oh, I am an idiot. Its not strange behaviour at all, is it? Its a
perfectly understandable side-effect of having auto_globals_jit = on,
and instead of setting that to off, its better not to use the
superglobal $GLOBALS for accessing _SERVER. I should have read the
discussion properly!
Previous Comments:
------------------------------------------------------------------------
[2010-06-05 12:47:17] php at caves dot org dot uk
An alternative to the workaround of putting "register_long_arrays = On",
in php.ini is to include a reference to $_SERVER (etc) *anywhere* in
your PHP script. This seems to trigger the population of $GLOBALS with
the correct data. The following example demonstrates this. Un-comment
the lines at the bottom to implement and demonstrate the work-around.
echo "_SERVER array is {$GLOBALS['_SERVER']} <BR>";
echo "_GET array is {$GLOBALS['_GET']} <BR>";
echo "_POST array is {$GLOBALS['_POST']} <BR>";
echo "_FILES array is {$GLOBALS['_FILES']} <BR>";
echo "_COOKIE array is {$GLOBALS['_COOKIE']} <BR>";
echo "_REQUEST array is {$GLOBALS['_REQUEST']} <BR>";
echo "_ENV array is {$GLOBALS['_ENV']} <BR><BR>";
//echo "\$_SERVER is $_SERVER<BR>";
//echo "\$_REQUEST is $_REQUEST<BR>";
//echo "\$_ENV is $_ENV<BR>";
------------------------------------------------------------------------
[2004-11-12 08:46:06] [email protected]
$GLOBALS["_SERVER"] would be silly to use anyway. I am going to mark
this as Wont Fix as this is not guaranteed to work.
------------------------------------------------------------------------
[2004-11-11 10:58:20] webmaster at ragnarokonline dot de
Yes, I could reproduce this without using mmcache.
This is dependent of auto_globals_jit. The problem is, that for example
var_dump($_SERVER); does trigger the jit, but that
var_dump($GLOBALS['_SERVER']); doesn't.
------------------------------------------------------------------------
[2004-11-11 09:56:02] [email protected]
Can you reproduce it without mmcache enabled ?
------------------------------------------------------------------------
[2004-11-11 09:17:12] marrtins at hackers dot lv
i think this is a mmcache issue. today i get similar problems - once
file is loaded with mmcache it is ok, next time there is no more
$_SERVER variable executing that script again.
notice, that it happens with apache (v 1.3.33), from command line same
script works well (php5.0.2).
also, with php4.3.7+apache1.3.27 it works as excpected too.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/bug.php?id=29176
--
Edit this bug report at http://bugs.php.net/bug.php?id=29176&edit=1