1/-2*5 (bug 41401)

php.internals

Stanislav Malyshev

19 years ago
Looks like we have a precedence bug in the parser rules there. Fortunately it's quite easy to fix, for example writing the rules as: | '+' expr %prec T_INC | '-' expr %prec T_INC seems to work. Any reason not to?
-- Stanislav Malyshev, Zend Products Engineer stas@zend.com http://www.zend.com/

Rasmus Lerdorf

19 years ago
Stanislav Malyshev wrote:
> Looks like we have a precedence bug in the parser rules there. > Fortunately it's quite easy to fix, for example writing the rules as: > > | '+' expr %prec T_INC > | '-' expr %prec T_INC > > seems to work. Any reason not to?
I think this should go in. It is an obvious mistake in the parser as far as I am concerned. -Rasmus

Derick Rethans

19 years ago
On Fri, 18 May 2007, Rasmus Lerdorf wrote:
> Stanislav Malyshev wrote: > > Looks like we have a precedence bug in the parser rules there. > > Fortunately it's quite easy to fix, for example writing the rules as: > > > > | '+' expr %prec T_INC > > | '-' expr %prec T_INC > > > > seems to work. Any reason not to? > > I think this should go in. It is an obvious mistake in the parser as > far as I am concerned.
However, it's probably possible that this will break some stuff for people, so I don't think we should do it in PHP 4.4. regards, Derick

Richard Lynch

19 years ago
On Fri, May 18, 2007 12:03 pm, Derick Rethans wrote:
> On Fri, 18 May 2007, Rasmus Lerdorf wrote: > >> Stanislav Malyshev wrote: >> > Looks like we have a precedence bug in the parser rules there. >> > Fortunately it's quite easy to fix, for example writing the rules >> as: >> > >> > | '+' expr %prec T_INC >> > | '-' expr %prec T_INC >> > >> > seems to work. Any reason not to? >> >> I think this should go in. It is an obvious mistake in the parser >> as >> far as I am concerned. > > However, it's probably possible that this will break some stuff for > people, so I don't think we should do it in PHP 4.4.
Honestly, anybody who has any code that this breaks and hasn't caught it yet is probably just a time bomb waiting to mess them up, even in 4.4, as far as I can tell... I suspect most developers just wrapped some parens around the bug and moved on with life...
-- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So?