Re: Re: PHP 5.1 (Or How to break tousands of apps out there)

From: Date: Sun, 27 Nov 2005 19:12:18 +0000
Subject: Re: Re: PHP 5.1 (Or How to break tousands of apps out there)
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-20665@lists.php.net to get a copy of this message
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

« previous php.internals (#20665) next »