Bug #18516 Updated: Variable-variables referencing a superglobal in a function don't work

From: Date: Wed, 24 Jul 2002 01:17:50 +0000
Subject: Bug #18516 Updated: Variable-variables referencing a superglobal in a function don't work
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-14971@lists.php.net to get a copy of this message
ID: 18516 Updated by: sniper@php.net Reported By: dilbert@hack3r.com -Status: Open +Status: Bogus Bug Type: Variables related Operating System: All PHP Version: 4.2.2 New Comment: RTFM: http://www.php.net/manual/en/language.variables.variable.php Previous Comments: ------------------------------------------------------------------------ [2002-07-23 19:14:42] dilbert@hack3r.com <? $h= "_GET"; print_r($$h); echo "<hr>"; function g() { print_r($_GET); } g(); echo "<hr>"; function t() { $g= "_GET"; print_r($$g); } t(); echo "<hr>"; $h = "hi"; function b() { global $h; $g = "h"; print_r($$g); } b(); ?> I've reported a similiar bug earlier (but forgot to include something trivial in the test script and thought it was a larger one than it is... i was rebuffed, it was marked bogus, and nobody seems to pay attention to "bogus" bugs) In the function above: The first print_r works as expected, verifying that variable-variable referencing DOES work. The g() function works as expected, verifying that superglobals are available in function scope. The t() function seems to do NOTHING, this is where the bug seems to be. The b() function works as expected, verifying that it works with regular globals. -- This has been tested and observed on OpenBSD and linux, with PHP versions 4.2.1 and 4.2.2 Ted ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=18516&edit=1

« previous php.bugs (#14971) next »