Skip to content

[pull] master from php:master#786

Merged
pull[bot] merged 1 commit intoturkdevops:masterfrom
php:master
Mar 15, 2026
Merged

[pull] master from php:master#786
pull[bot] merged 1 commit intoturkdevops:masterfrom
php:master

Conversation

@pull
Copy link

@pull pull bot commented Mar 15, 2026

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

* Fix ReflectionMethod::invoke() crash with internal closures

The closure identity check added in GH-21366 accessed op_array.opcodes
unconditionally, but internal closures (e.g. var_dump(...)) use
internal_function, not op_array. This caused undefined behavior when
comparing closures created via first-class callable syntax on internal
functions.

Check the function type first: compare op_array.opcodes for user
closures, compare the function pointer directly for internal closures.

* Fix internal closure comparison and expand test coverage

The previous comparison (orig_func == given_func) could never match for
internal closures since zend_get_closure_method_def() returns a pointer
to each closure's embedded copy. Compare function_name and scope instead.

Also handle the mixed user/internal type case explicitly.

Add tests for: userland first-class callables, cloned internal closures,
and cross-type (user vs internal) closure rejection.

* php_reflection: Simplify the Closure::__invoke() check

---------

Co-authored-by: Tim Düsterhus <tim@bastelstu.be>
@pull pull bot locked and limited conversation to collaborators Mar 15, 2026
@pull pull bot added the ⤵️ pull label Mar 15, 2026
@pull pull bot merged commit 4561e92 into turkdevops:master Mar 15, 2026
1 check failed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant