Edit report at https://bugs.php.net/bug.php?id=55493&edit=1
ID: 55493
Patch added by: laruence@php.net
Reported by: vovan-ve at yandex dot ru
Summary: Superglobal variable variables with ${expression} in
non-global scope
Status: Assigned
Type: Feature/Change Request
Package: Variables related
Operating System: Windows XP SP3
PHP Version: 5.3.7
Assigned To: dmitry
Block user comment: N
Private report: N
New Comment:
The following patch has been added/updated:
Patch Name: bug55493.patch
Revision: 1314190137
URL: https://bugs.php.net/patch-display.php?bug=55493&patch=bug55493.patch&revision=1314190137
Previous Comments:
------------------------------------------------------------------------
[2011-08-24 10:21:23] vovan-ve at yandex dot ru
When I tried to obfuscate a part of code I was surprised by this strange behariour. Of course,
current implementation is correct on the one hand. But on the other hand the situation looks funny:
this way is allowad, and this too, but this is not.
------------------------------------------------------------------------
[2011-08-24 04:11:14] laruence@php.net
sure, it can be fixed by decide target symbol table again in the execution time
for not const OPs,
but I don't think this is really necessary . :)
------------------------------------------------------------------------
[2011-08-23 18:16:12] kalle@php.net
This still seems a little strange that we cannot pick the correct symbol table at compile time, all
it should need would be a check to see if the compiled value is matching one thats a super global.
I remember to have encountered something similar a while back, which I'm not sure if I reported
or not, but def. something we should look into at some point.
Dmitry, can you clarify this?
------------------------------------------------------------------------
[2011-08-23 16:49:00] laruence@php.net
As I said, this is a limitation of PHP design, so mark as won't fix.
Thank you for your interest in PHP.
------------------------------------------------------------------------
[2011-08-23 16:22:46] laruence@php.net
when fetching a variable, the target symbol table is decided in compiling time,
for the script above, in compiling time, only const string "_SERVER" can be
took consider as a SUPERVAR and assign the global symbol table as
target_symbol_table.
the others varname only can be see in execution time, so Zend VM think it
should be fetched from a local symbol table.
and the 'local symbol table' for the global scope statement is actual 'global
symbol table', therefor it works 'as expected'.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=55493
--
Edit this bug report at https://bugs.php.net/bug.php?id=55493&edit=1