Fix ?? on $_GET keys without undefined-key warning (VM) - #431
Merged
Conversation
php-cfg emits ArrayDimFetch before Coalesce as separate statements; the eager fetch ran before isset and triggered Zend-style warnings. Skip the orphan fetch, resolve the dim fetch for isset(container, dim), and add VM/real regression tests. Closes #273 follow-up for the recommended $_GET['key'] ?? default pattern (VM). AOT/JIT coalesce on runtime superglobals remains a separate LLVM merge fix. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
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
ArrayDimFetchas a separate statement before??(common for$_GET['name'] ?? 'Guest').Warning: Undefined array keybefore the coalesce branch; usesisset(container, dim)instead.docs/runtime-semantics.md.Issue
Closes #273 (undefined superglobal key +
??pattern). Builds on closed #99 (null coalescing).Test plan
docker run … php-compiler:22.04-dev ./script/ci-local.sh --filter coalesce$_GET['name'] ?? 'Guest'with emptyQUERY_STRING→Guest, no warningQUERY_STRING=name=World→WorldFollow-up
AOT/JIT
??on runtime superglobals still needs LLVM merge/phi work (module verify fails today); leftexamples/001-SimpleWebon direct$_REQUEST['name']until that lands.Made with Cursor