ID: 48478 User updated by: arancaytar dot ilyaran at gmail dot com Reported By: arancaytar dot ilyaran at gmail dot com Status: Open Bug Type: Arrays related Operating System: Ubuntu 9.04 PHP Version: 6CVS-2009-06-05 (snap) New Comment:
Failed to add; this will also work: print $_SERVER[(binary)'SCRIPT_NAME']; That's pretty nasty to have to do consistently though. You could work around it by defining constants for all keys: define(SCRIPT_NAME, (binary)'SCRIPT_NAME'); print $_SERVER[SCRIPT_NAME]; But that's also ugly. It'd be more convenient if the keys were in Unicode by default. Previous Comments: ------------------------------------------------------------------------ [2009-06-05 11:22:04] arancaytar dot ilyaran at gmail dot com 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 this bug report at http://bugs.php.net/?id=48478&edit=1