Skip to content

Language: by-ref param ASSIGN_REF rebinds local CV only (#22546)#22552

Merged
PurHur merged 2 commits into
masterfrom
agent/issue-22546-assign-ref-rebind
Jul 23, 2026
Merged

Language: by-ref param ASSIGN_REF rebinds local CV only (#22546)#22552
PurHur merged 2 commits into
masterfrom
agent/issue-22546-assign-ref-rebind

Conversation

@PurHur

@PurHur PurHur commented Jul 23, 2026

Copy link
Copy Markdown
Owner

Summary

Closes #22546

php-src reference

  • Zend/zend_vm_def.hZEND_ASSIGN_REF
  • Zend/zend_execute.c — by-ref arg binding + local symbol rebind

PHP implementation

  • lib/VM.phpTYPE_ASSIGN_REF write-target selection via resolveScopeSlotVariableName

Test plan

  • Issue repro:
./script/docker-exec.sh -- bash -lc 'php bin/vm.php test/repro/issue_22546_byref_param_assign_ref_rebind.php'
# NULL / NULL / 99
  • Compliance:
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit --filter "byref_param_assign_ref_rebind|static_assign_ref_param_disconnect|dim_ref_survives|reference_survives_unset|array_append_by_ref|object_property_assign_by_ref" test/compliance/VMTest.php'
# OK (6 tests)

Trust probe (pre-claim)

Made with Cursor

PurHur and others added 2 commits July 23, 2026 06:17
Zend `$a =& $x` updates the named symbol table slot; peeling through a prior
IS_REFERENCE incorrectly mutated the caller / previous referent.

Co-authored-by: Cursor <cursoragent@cursor.com>
Cover function `global $g =&` disconnect and main-script `$GLOBALS` linkage
alongside the by-ref param repro.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur merged commit 0e759fa into master Jul 23, 2026
@PurHur
PurHur deleted the agent/issue-22546-assign-ref-rebind branch July 23, 2026 06:19
@PurHur
PurHur restored the agent/issue-22546-assign-ref-rebind branch July 23, 2026 06:19
@PurHur

PurHur commented Jul 23, 2026

Copy link
Copy Markdown
Owner Author

Cleanup hygiene

Deleting remote branch agent/issue-22546-assign-ref-rebind.

Reason: PR merged into master (#22552 / 0e759fa46); issue #22546 closed; no open PR on this head.

Open PR #22717 (agent/issue-22642-gen0-refresh-oom) and release/v1.1.0-dev left untouched.

@PurHur
PurHur deleted the agent/issue-22546-assign-ref-rebind branch July 23, 2026 19:44
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.

Language: by-ref param $a =& $static rebind mutates caller — Zend leaves caller unchanged (Zend/zend_execute.c)

1 participant