Skip to content

Zend: follow-up for GH-22145. Fix zend_fcc_closure_equals_ex() implementation - #24007

Open
Girgias wants to merge 3 commits into
php:PHP-8.6from
Girgias:8.6-fake-closures-internal-fns
Open

Girgias wants to merge 3 commits into
php:PHP-8.6from
Girgias:8.6-fake-closures-internal-fns

Conversation

@Girgias

@Girgias Girgias commented Sep 30, 2026

Copy link
Copy Markdown
Member

This is effectively a follow-up to #22145 to properly fix #22118 with internal functions.

It turns out that to prevent memory leaks for fake closures of internal functions, the zif_handler is changed to zend_closure_internal_handler and the true zif_handler is stored in the orig_internal_handler field of the zend_closure struct.

So return func1->internal_function.handler == func2->internal_function.handler; could never return true for internal functions.

We need to keep zend_fcc_closure_equals_ex() as the ABI is frozen, but it probably makes sense to clean this all up in master.

I'll definitely write some docs about zend_closure after I finished the FCI/FCC ones as this is incredibly confusing.

Fake closures for internal functions could not return that they were equal due to the zif_handler being wrapped
@Girgias
Girgias requested a review from TimWolla September 30, 2026 00:30
@Girgias
Girgias marked this pull request as ready for review September 30, 2026 12:32
@Girgias
Girgias requested a review from dstogov as a code owner September 30, 2026 12:32
@Girgias
Girgias requested a review from iluuu1994 October 1, 2026 12:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant