-
Notifications
You must be signed in to change notification settings - Fork 7.9k
[RFC] Autoloading functions #15471
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
[RFC] Autoloading functions #15471
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
7e8220a
to
853ba55
Compare
7ea020e
to
0573de6
Compare
d6e849b
to
a90fdf6
Compare
I do not have an ARM machine to test this PR on. Can someone potentially get the logs for the failing tests? |
c5d07d5
to
d922c89
Compare
Possibly, the job isn't failing because of arm, but because of the test flags. Namely:
|
@iluuu1994, looks like a bug with opcache? The error is:
and the script is: namespace {
spl_autoload_register(function(string $name, int $mode) {
echo "name=$name, mode=$mode\n";
}, true, false, SPL_AUTOLOAD_FUNCTION);
}
namespace Foo {
echo strlen('foo') . "\n";
} |
7cd390d
to
02a9e9c
Compare
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.
This PR implements the function autoload v4 RFC.
Key overview:
spl_autoload_register
to allow registering functions to load functions and/or classes. This involves two new constants:SPL_AUTOLOAD_CLASS
andSPL_AUTOLOAD_FUNCTION
.zend_execute.c
andzend_execute.h
to implement autoloading of functions.zend_locate_function
which searches the function table before performing an autoload. It returns the zval of the function, orNULL
. It can be used as a drop-in replacement for looking up a function in the function table directly.Note before merging: Symfony has some code that is broken by this change. I've updated the benchmark loader to point to my fork of the benchmarks. As you can see the changes are very minimal.
Note: this does not include potential changes to opcache's JIT, which may need changes in
zend_jit_find_func_helper
,zend_jit_jmp_frameless_helper
, andzend_jit_find_ns_func_helper