Language: nullsafe ?-> method call inline arg compile + short-circuit (#17186) - #17188
Merged
Merged
Conversation
…cuit (#17186) Pass the NullsafeMethodCall CFG op into compileCallArgSends and defer immediately preceding inline arg producers (IIFE FuncCall) into the non-null fetch block so arguments are not evaluated on a null receiver. Co-authored-by: Cursor <cursoragent@cursor.com>
3 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
NullsafeMethodCallas$cfgCallOpintocompileCallArgSends()so inline argument lowering no longer fatals inouterSiblingInlineCallArgProducerSlot().FuncCall+Closure) into the nullsafe fetch block so arguments are not evaluated when the receiver is null (Language: nullsafe operator (?->) — short-circuit + error semantics parity #4394 / php-src?->short-circuit).Root cause
compileNullsafeMethodCall()calledcompileCallArgSends($expr->args, $fetchBlock)without the CFG call op. php-cfg also uses a distinct arg temporary (#6) vs the inline producer result (#5), so the existing prelude deferral slice never matched IIFE arguments.php-src reference
Zend/zend_compile.c— nullsafe method call compile; argument evaluation only on non-null receiver branchPHP implementation
lib/Compiler.php—compileNullsafeMethodCall, deferred nullsafe prelude scan,isNullsafeMethodCallArgPreludeProducer()Verification
Closes #17186
Made with Cursor