Skip to content

Language: instance-method FCC must not poison later static:: / :static (#32083) - #32095

Merged
PurHur merged 1 commit into
masterfrom
agent/issue-32083-fcc-poisons-static
Aug 18, 2026
Merged

PurHur merged 1 commit into
masterfrom
agent/issue-32083-fcc-poisons-static

Conversation

@PurHur

@PurHur PurHur commented Aug 18, 2026

Copy link
Copy Markdown
Owner

Summary

  • Instance-method first-class callables ($obj->m(...)) wrote the FCC class onto the caller frame's calledClass, and Block::getFrame() copied that LSB into every later nested call in the same unit.
  • php-src: Zend/zend_compile.c ZEND_AST_CALLABLE_CONVERT must not change later static::class / : static called-scope (Zend/zend_execute.c).
  • PHP implementation: lib/VM.php (initClosureCall no longer mutates caller LSB; callee still gets it via applyClosureBinding) and lib/Block.php (copy calledClass only on same-function CFG edges, Regression: Closure::bind scope + private static ?? throws — Zend coalesces (Zend/zend_closures.c) #24335). No new runtime/*.c.

Closes #32083

Test plan

Verification

./script/docker-exec.sh -- bash -lc 'php bin/vm.php test/repro/maintainer_gap_fcc_poisons_static.php'
fcc=8
lsb=Base Child
ret=B3
VM_EXIT:0
./script/docker-exec.sh -- bash -lc 'php bin/jit.php test/repro/maintainer_gap_fcc_poisons_static.php'
fcc=8
lsb=Base Child
ret=B3
JIT_EXIT:0
./script/phpunit.sh --filter 'testVmInstanceMethodFccDoesNotPoisonLaterStatic|testVmIsolatedStaticClassAndReturnTypeStillMatchZend|testVmSelfStaticMethodFccPreservesLateStaticBinding'

OK (3 tests, 3 assertions)

./script/phpunit.sh test/compliance/ClosureVMTest.php --filter 'first_class_callable_self_static_lsb|fcc_instance_method_poisons_static'

OK (2 tests, 2 assertions)

./script/phpunit.sh test/unit/FirstClassCallableTest.php

OK (39 tests, 46 assertions)

Full ClosureVMTest (59 cases): 1 pre-existing master failure closure_call_method_rebind (Cannot call non-static {closure}() statically) — reproduced on untouched master; not introduced by this diff.

Not covered: full VMTest/JITTest suites, script/differential-sweep.sh, AOT.

php-src-strict; no php-compiler-strict shortcut.

Made with Cursor

…tic:: / :static (#32083)

ZEND_AST_CALLABLE_CONVERT must not change later methods' late-static scope. Stop writing the FCC class onto the caller frame and copy calledClass only across same-function CFG edges.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur merged commit 29b70bb into master Aug 18, 2026
1 check failed
@PurHur
PurHur deleted the agent/issue-32083-fcc-poisons-static branch August 18, 2026 05:34
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: instance-method FCC poisons later static::class / :static in the same unit (Zend/zend_compile.c)

1 participant