Repository navigation
[8.6] Fix array_map() optimization not resolving the class name of a static FCC - #24244
Open
claudiodekker wants to merge 1 commit into
Open
claudiodekker wants to merge 1 commit into
claudiodekker wants to merge 1 commit into
Conversation
This was referenced Oct 10, 2026
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.
When
array_map()is compiled into a loop, the class name of a static first-class callable is compiled as an expression. That gives the name as written, without resolving it against the current namespace oruseimports, so the call fails with "Class not found" at runtime:Only fully qualified names work. Inside a namespace the bug shows only with
\array_map(), because an unqualifiedarray_map()there isn't optimized.self,parentandstaticare not affected.This was introduced in 40a8468 (GH-23254), which started evaluating the class name once before the loop. Bisected between RC3 and the point where PHP-8.6 branched from PHP-8.5.
The fix resolves a literal class name with
zend_resolve_class_name_ast()before the loop body is compiled, the same wayzend_compile_class_ref()does for a regular static call.self,parent,staticand dynamic class expressions still take the existing path.The new test covers imported, aliased,
namespace\-relative and fully qualified names in the global namespace, a namespace-relative name under\array_map(), andself,parentandstaticinside a class.Tested with
make test TESTS="Zend/tests ext/opcache/tests ext/standard/tests/array"on--enable-debugand--enable-debug --enable-ztsbuilds, with opcache off and on. The new test fails without the fix and passes with it.