#50929 [NEW]: Incorrect initialization of $_SERVER
From: t-bader at gmx dot net
Operating system: Windows Vista/7
PHP version: 5.3.1
PHP Bug Type: Variables related
Bug description: Incorrect initialization of $_SERVER
Description:
------------
The manual says that Superglobals can be referenced by variable variables
in global scope.
For the $_SERVER superglobal does this only work at it first "normal"
usage.
<?php
$Superglobal = '_SERVER';
var_dump($$Superglobal);
?>
Outputs: NULL
But if i use the $_SERVER Variable after the var_dump(); the var_dump()s
output is correct:
<?php
$Superglobal = '_SERVER';
var_dump($$Superglobal);
$_SERVER;
var_dump($$Superglobal);
?>
Both var_dump()s output the whole $_SERVER array. If i remove the line
with $_SERVER; both var_dump()s output is NULL.
Reproduce code:
---------------
<?php
$Superglobal = '_SERVER';
var_dump($$Superglobal);
?>
Expected result:
----------------
Array containing the $_SERVER variables
Actual result:
--------------
NULL
--
Edit bug report at http://bugs.php.net/?id=50929&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=50929&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=50929&r=trysnapshot53
Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=50929&r=trysnapshot60
Fixed in SVN: http://bugs.php.net/fix.php?id=50929&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=50929&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=50929&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=50929&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=50929&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=50929&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=50929&r=support
Expected behavior: http://bugs.php.net/fix.php?id=50929&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=50929&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=50929&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=50929&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=50929&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=50929&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=50929&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=50929&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=50929&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=50929&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=50929&r=mysqlcfg
Thread (2 messages)
- t-bader at gmx dot net