|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-06-06 10:57 UTC] arancaytar dot ilyaran at gmail dot com
[2010-06-08 15:36 UTC] tony2001@php.net
-Status: Open
+Status: Feedback
[2010-06-08 15:36 UTC] tony2001@php.net
[2013-02-18 00:33 UTC] php-bugs at lists dot php dot net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 23:00:02 2025 UTC |
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