Fix GH-22118: Compare equivalent fake closures in FCCs#22145
Open
prateekbhujel wants to merge 1 commit into
Open
Fix GH-22118: Compare equivalent fake closures in FCCs#22145prateekbhujel wants to merge 1 commit into
prateekbhujel wants to merge 1 commit into
Conversation
Girgias
requested changes
May 25, 2026
Member
Girgias
left a comment
There was a problem hiding this comment.
IMO this should be fixed in zend_fcc_equals() as this same issue would crop up if trying to register and unregister an autoloader using a FCC.
aa37b64 to
7c2e35c
Compare
Contributor
Author
|
Sorry, you’re right, this was too narrowly placed before. I moved the fake-Closure comparison into I pushed the updated branch and ran the focused tick + SPL autoload tests locally. |
Girgias
requested changes
May 25, 2026
Member
Girgias
left a comment
There was a problem hiding this comment.
Trampoline test and this needs to be backported to PHP 8.4 rather than 8.5 as this issue has existed for longer.
7c2e35c to
b49ce7c
Compare
Girgias
reviewed
May 25, 2026
b49ce7c to
5024c3e
Compare
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.
First-class method callable syntax creates a fresh fake Closure object for each expression. Some callback comparisons were still treating Closure-backed callables by Closure object identity, so equivalent fake Closures could fail to unregister.
Update
zend_fcc_equals()so regular Closure objects still compare by object identity, while fake Closures compare through their Closure method definition instead of generic object comparison. Onmaster, SPL autoload already useszend_fcc_equals(), so the same path is covered there too.Fixes GH-22118.
Tests:
PATH="/opt/homebrew/opt/bison/bin:/opt/homebrew/bin:$PATH" ./configure --disable-all --enable-cliPATH="/opt/homebrew/opt/bison/bin:/opt/homebrew/bin:$PATH" make -j$(sysctl -n hw.ncpu) sapi/cli/phpsapi/cli/php run-tests.php -q -p sapi/cli/php ext/standard/tests/general_functions/gh22118.phpt ext/spl/tests/autoloading/gh22118.phpt ext/spl/tests/autoloading/gh10011.phpt ext/spl/tests/autoloading/spl_autoload_013.phpt ext/spl/tests/autoloading/spl_autoload_014.phpt ext/spl/tests/autoloading/bug75049.phpt ext/spl/tests/autoloading/spl_autoload_unregister_without_registrations.phpt ext/standard/tests/general_functions/bug66094.phpt