Repository navigation
Fix partial application treating methods named assert() as the global assert() - #25771
Merged
Merged
Conversation
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
DanielEScherzer
left a comment
Member
There was a problem hiding this comment.
this should probably be targeting PHP 8.6 rather than master
zp_compile_forwarding_call() checked function_name against ZEND_STR_ASSERT without checking ZEND_INTERNAL_FUNCTION and
common.scope == NULL, causing partial application on methods or user functions named assert() to call global assert().
hohphu8
force-pushed
the
fix-pfa-method-named-assert
branch
from
November 26, 2026 05:09
4b28892 to
e621cc5
Compare
Contributor
Author
|
thanks, moved to PHP-8.6. same code is there and the test passes on it |
* PHP-8.6: Fix stale string metadata in sodium_add() and sodium_increment() (php#25775) Sync `session.upload_progress.enabled` default in `php.ini-{development,production}` (php#25743) ext/pgsql: fix pg_fetch_object() JIT crash when constructor keeps $this Fix hash() and hash_file() hanging on invalid xxh3/xxh128 options (php#25777) Fix phar_set_inode() using the zend_string header instead of the filename (php#25768) Fix phpGH-25360: ZipArchive assertion when error handler throws at shutdown (php#25361)
arnaud-lb
added a commit
that referenced
this pull request
Nov 26, 2026
* PHP-8.6: Fix partial application treating methods named assert() as the global assert() (#25771)
Member
|
Thank you! |
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.
In
zp_compile_forwarding_call()(Zend/zend_partial.c),is_assertis decided by comparing only the function name with"assert". A partial application of a method namedassert, such as$obj->assert(?)orCls::assert(?), therefore matches, and the generated code calls\call_user_func('assert', ...), which invokes the globalassert()instead of the method. Withzend.assertions=1this throws anAssertionErrorinstead of calling the method.This restricts the check to internal functions without a class scope (
function->type == ZEND_INTERNAL_FUNCTION && !function->common.scope).Adds
Zend/tests/partial_application/method_named_assert.phptcovering instance and static methods namedassert, plus a control that partial application of the real\assert(?)still works. It fails before the fix and passes after.Note: I found this through source inspection with an automated/LLM-assisted tool, then reproduced and verified it myself.