From: arancaytar dot ilyaran at gmail dot com
Operating system: Ubuntu 9.04
PHP version: 6CVS-2009-06-05 (snap)
PHP Bug Type: Arrays related
Bug description: Super-globals cannot be accessed with literal keys
Description:
------------
In the current snapshot of PHP6, the values stored in the "internal"
$_SERVER and $_ENV super-globals cannot be accessed using literal string
keys like $_SERVER['SCRIPT_NAME'].
This is because the array keys in these super-globals are of type
"string", while literals in the script implicitly are of type "unicode".
This problem does not occur in $_GET, $_POST and $_REQUEST, because the
request parameter names are implicitly in unicode too.
Reproduce code:
---------------
// This will fail and print a notice:
print $_ENV['SHELL'] . "\n";
// This works:
foreach($_ENV as $key => $value)
if ($key == 'SHELL')
print $_ENV[$key] . "\n";
// This will work:
foreach ($_ENV as $key => $value)
$_ENV["$key"] = $value;
print $_ENV['SHELL'] . "\n";
Expected result:
----------------
/bin/bash
/bin/bash
/bin/bash
Actual result:
--------------
Notice: Undefined index: SHELL in - on line 2
/bin/bash
/bin/bash
--
Edit bug report at http://bugs.php.net/?id=48478&edit=1
--
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=48478&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=48478&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=48478&r=trysnapshot60
Fixed in CVS:
http://bugs.php.net/fix.php?id=48478&r=fixedcvs
Fixed in CVS and need be documented:
http://bugs.php.net/fix.php?id=48478&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=48478&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=48478&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=48478&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=48478&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=48478&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=48478&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=48478&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=48478&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=48478&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=48478&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=48478&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=48478&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=48478&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=48478&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=48478&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=48478&r=mysqlcfg