Resolve function imports before dispatch and policy checks - #108
Open
yavon007 wants to merge 2 commits into
Open
Resolve function imports before dispatch and policy checks#108yavon007 wants to merge 2 commits into
yavon007 wants to merge 2 commits into
Conversation
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.
Calls through
use functionaliases can resolve to the wrong target when thecall's casing differs from the import, or when a same-named compiled global
function exists. For example, a user function imported as GET_CALLED_CLASS
is bypassed by
get_called_class(), causing the built-in to run and throw.Normalize function-alias keys during registration and lookup. When an
unqualified call names an imported function, use only the imported target for
native-function resolution rather than checking global functions first.
Keep absolute/qualified calls and class/constant imports unchanged.
Resolve the imported target before special-function and capability-policy
checks as well: safe functions must not be rejected because their alias names
a restricted built-in, and restricted functions must not evade policy through
an innocuous alias.
Add codegen and PHP/AOT behavioral coverage for mixed-case aliases, built-in
aliases, grouped imports, global name collisions, and explicit global calls.
Codegen assertions verify the selected imported and global targets; the
compiled regression matches PHP output exactly with empty stderr.
Additional compile-only tests ensure an imported exec alias is rejected under
both Nano and WASI, while a user function aliased as extract remains callable.
Focused PHPUnit: 115 tests / 632 assertions pass (11 existing deprecations).
The complete 135-file compiler self-build and --version check pass. The
resulting compiler also builds and runs the regression with PHP-identical output.
Tested on Linux ARM64, PHP 8.5.10 ZTS, GCC and PHPX 4b3a472. No benchmark
speedup is claimed.