-
Notifications
You must be signed in to change notification settings - Fork 7.9k
ZEND_INIT_FCALL is only produced when function exists at compile time #7728
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
Conversation
Hmm, some extensions may not like this. @TysonAndre may have more to say about that. |
I don't know if this is possible to change in extension land, but a possible fix if possible, is to change the compiler globals by adding the |
Or to change the opcodes pointing to the function in-place in that extension - that extension already has issues when enabling opcache in the latest php versions. Unrelatedly,
Ideally, there might be a list of module/zend_module dependencies in the cache generated by opcache (for file cache) to detect this, but I don't remember there being one? (e.g. if a function foo_xyz() was from PECL/php-src module "foo", add a dependency on foo and overwrite that file cache entry) |
That should be no longer the case with recent PHP versions, since there is now a |
Just to clarify, are you okay with this change? I'll add an entry to UPGRADING.INTERNALS in any case as it may break other extensions which try to do funky things. |
It seems like I can get internal function manipulation to continue to work, so I'm fine with this change. I looked into it some more. Adding notes in case I or other extension developers need them in the future.
I assume there'd be a few percent performance hit from needing to recalculate stack sizes and using less specialized arg handlers (and possibly worse opcache inference), but haven't benchmarked it. That could probably be controlled by an ini directive such as
CG(compiler_options) |= ZEND_COMPILE_IGNORE_USER_FUNCTIONS | ZEND_COMPILE_IGNORE_INTERNAL_FUNCTIONS;
|
I can explain where the +1 comes from, when a function call is compiled in Similarly |
39e2a14
to
6b987f2
Compare
Thanks, makes sense. And |
Was a lot of staring and trying to come up with a test case for the undefined function case here while working on function autoloading, but I'm fairly certain this cannot ever happen from me staring at
zend_compile.c