|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-04-05 11:52 UTC] johannes@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Nov 21 05:00:01 2025 UTC |
Description: ------------ When constructing a variable name using the $$foo syntax, it is only possible to reference a superglobal in this way from outside a function. Inside a function it appears to reference a variable with the same name that is local to the function. In other words, the code $foo='_REQUEST'; print (${$foo}['bar']); behaves differently within a function and within the main loop. I've been able to reproduce this bug on several servers with different configurations. 4.3.10 is the latest version I have available to test. Reproduce code: --------------- Demonstration http://www.dur.ac.uk/c.i.morris/superglobals.php?foo=123 Source code http://www.dur.ac.uk/c.i.morris/superglobals.phps [Note: this server is running an older version of PHP, but the same effect happens on a non-public server running 4.3.10] Expected result: ---------------- Out of the function:123 In the function:123 Actual result: -------------- Out of the function:123 In the function: