[php-src] PR #25074: Fix GH-25061: $x = $x - 1 on null is optimized to PRE_DEC
| From: | lazerg | Date: | Sat, 31 Oct 2026 06:10:06 +0000 |
| Subject: | [php-src] PR #25074: Fix GH-25061: $x = $x - 1 on null is optimized to PRE_DEC | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-40121@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/25074
Author: lazerg
The DFA pass turns
$x = $x - 1 into PRE_DEC when the operand can only be
null, undef or a number. That is fine for + 1, but not for - 1: null
- 1 is -1, while --$x on null leaves it null. The
ASSIGN_OP SUB rule right below already excludes MAY_BE_UNDEF|MAY_BE_NULL,
so the two SUB contraction rules now do the same.
Fixes GH-25061