> i must admit, that i don't know very much about the zend engine and the 
> php core in general, but if "opline->op2.u.EA.type" "knows" if the 
> variable is a local one, a global one or a static one, why hasn't it the 
> value of ZEND_FETCH_GLOBAL for superglobals in the first place?
>
opline->op2.u.EA.type is set at compile time.

In the case of $_GET, the compiler knows that _GET is a superglobal so it 
sets it to ZEND_FETCH_GLOBAL
In the case of $$g (where $g was previously set to '_GET') the compiler 
doesn't know what $g is yet (since it's only really set at runtime), so it 
has no reason to set it to ZEND_FETCH_GLOBAL.

Could it be intelligent enough to see that in:
$g = '_GET';
$$g is always going to be '_GET' and therefor $$g and $_GET are really the 
same thing?
Perhaps.

But what about:
$g = '_';
$g .= 'G';
$g .= 'E';
$g .= 'T';

Or the enigmatic:
$g = '_TRG';
$g = str_rot13($g);

Building the run-time intelligence into a compiler would be.... well do I 
really need to spell that one out?

-Sara 

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to