ID: 22518 Updated by: [EMAIL PROTECTED] Reported By: rabus at users dot sourceforge dot net -Status: Open +Status: Bogus Bug Type: Scripting Engine problem Operating System: Windows NT PHP Version: 5CVS-2003-03-03 (dev) New Comment:
RTFM: http://www.php.net/manual/en/language.variables.predefined.php#language.variables.predefined "Variable variables: Superglobals cannot be used as variable variables." Previous Comments: ------------------------------------------------------------------------ [2003-03-03 09:22:00] daniel dot gorski at develnet dot org Similar malfunction here: <?php error_reporting(E_ALL); print_r($_SERVER); print_r($_ENV); ?> PHP Notice: Undefined variable: _SERVER in /var/webservers/cowiki/htdocs/test.php on line 6 PHP Notice: Undefined variable: _ENV in /var/webservers/cowiki/htdocs/test.php on line 7 Todays CVS, build as CGI on RH6.2 regards dtg ------------------------------------------------------------------------ [2003-03-03 08:06:46] rabus at users dot sourceforge dot net Please try the following script: <?php function foo() { echo $_SERVER; } foo(); ?> This script returns "Array". This is the expected behavior. Now, try this one: <?php function foo() { $bar = '_SERVER'; echo $$bar; } foo(); ?> This time, an error is returned: Notice: Undefined variable: _SERVER on line 4 This is nonsense, of course: As we see in the example above, the variable should be defined! ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=22518&edit=1
