Skip to content

AOT: $o->prop ??= $x = n stores 0/garbage — bind Assign.result (#35998) - #35999

Merged
PurHur merged 1 commit into
masterfrom
fix/35998-prop-coalesce-assign-expr
Aug 30, 2026
Merged

PurHur merged 1 commit into
masterfrom
fix/35998-prop-coalesce-assign-expr

Conversation

@PurHur

@PurHur PurHur commented Aug 30, 2026

Copy link
Copy Markdown
Owner

Summary

Root cause

php-cfg lowers $o->n ??= $x = 7 as ASSIGN($x, 7) → result temp then property ??= store from result temp. Named-storage assign only wrote $x.

php-src reference

  • Zend/zend_execute.c — ZEND_COALESCE / ZEND_ASSIGN / zend_assign_to_variable

Verification

./script/aot-smoke.sh
→ aot-smoke: 8 passed, 0 failed

./script/phpunit.sh --filter 'AotPropCoalesceAssignExprTest|InstancePropCoalesceAssign33748Test|AotPropByrefCoalesceTest'
→ OK (8 tests, 24 assertions)

./script/docker-exec.sh -- bash -lc 'php bin/vm.php test/repro/aot_prop_coalesce_assign_expr.php'
→ int(7) int(7) …

./script/docker-exec.sh -- bash -lc 'PHP_COMPILER_HELPER_RUNTIME_O=0 php bin/compile.php -o /tmp/coal.bin test/repro/aot_prop_coalesce_assign_expr.php && /tmp/coal.bin'
→ int(7) int(7) … (matches VM)

Not run: differential sweep, compliance suite, north-star5-verify-fast.

Closes #35998

Made with Cursor

Named TYPE_ASSIGN wrote only the alias variable ($x) and skipped the
Assign.result temp that `$o->p ??= $x = n` stores — same class as #29747.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur merged commit 78852fc into master Aug 30, 2026
1 check passed
@PurHur
PurHur deleted the fix/35998-prop-coalesce-assign-expr branch August 30, 2026 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AOT: $o->prop ??= $x = n stores 0/garbage — leftover of #33748 (Zend/zend_execute.c)

1 participant