Markus Fischer schrieb:
> Kevin Brown wrote:
>
>>The only scripts that would break (far from "trillions") here would be
>>those where you had a space-less ternary statement comparing two
>>constants (NOT namespace constants -- they don't even exist yet), as
>>in the following case:
>>
>>define('foo','odd');
>>define('bar','even');
>>$var = rand() % 2 == 1 ? foo:bar;
>
> Do we have a way getting numbers on how high the probability is that
> someone is using two constants in the ternary operator without spaces?
How exactly is this a big problem? Is the parser always working from
left to right and assigning a token on current context or is it looking
at the whole line? Is it impossible to give the ternary operator a
higher priority than the namespace operator?
Then the implementation could always treat foo:bar as being two
constants in the ternary. This way only new code not using whitespace
would throw parsing errors which actually means that NO existing code
breaks.
OLLi
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php