Language: instance-method FCC must not poison later static:: / :static (#32083) - #32095
Merged
Merged
Conversation
…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>
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
$obj->m(...)) wrote the FCC class onto the caller frame'scalledClass, andBlock::getFrame()copied that LSB into every later nested call in the same unit.Zend/zend_compile.cZEND_AST_CALLABLE_CONVERTmust not change laterstatic::class/: staticcalled-scope (Zend/zend_execute.c).lib/VM.php(initClosureCallno longer mutates caller LSB; callee still gets it viaapplyClosureBinding) andlib/Block.php(copycalledClassonly on same-function CFG edges, Regression: Closure::bind scope + private static ?? throws — Zend coalesces (Zend/zend_closures.c) #24335). No newruntime/*.c.Closes #32083
Test plan
FirstClassCallableTest+ClosureVMTest(new.phpt+ Language: self::method(...) FCC from child loses late static binding — static::class is parent (Zend/zend_closures.c) #27835 LSB)static::class/: staticwithout FCC still match Zend$this/ class-scope inheritance still greenVerification
OK (3 tests, 3 assertions)OK (2 tests, 2 assertions)OK (39 tests, 46 assertions)Full
ClosureVMTest(59 cases): 1 pre-existing master failureclosure_call_method_rebind(Cannot call non-static {closure}() statically) — reproduced on untouched master; not introduced by this diff.Not covered: full
VMTest/JITTestsuites,script/differential-sweep.sh, AOT.php-src-strict; no php-compiler-strict shortcut.
Made with Cursor