# 1/-2*5 (bug 41401)

- Thread: https://externals.io/message/29508
- Original archive: https://news-web.php.net/php.internals/29508
- Started by Stanislav Malyshev on 2007-05-18T01:57:08+00:00
- Messages: 4
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #29508 — Stanislav Malyshev — 2007-05-18T01:57:08+00:00

URL: https://externals.io/message/29508#29508

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/

---

## #29510 — Rasmus Lerdorf — 2007-05-18T12:26:46+00:00

URL: https://externals.io/message/29508#29510 · In reply to: #29508

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

---

## #29519 — Derick Rethans — 2007-05-18T17:03:59+00:00

URL: https://externals.io/message/29508#29519 · In reply to: #29510

> Stanislav Malyshev wrote:
> > […]
> 
> 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

---

## #29639 — Richard Lynch — 2007-05-21T20:11:05+00:00

URL: https://externals.io/message/29508#29639 · In reply to: #29519

> 
>
> > […]
>
> 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?
