Skip to content

Set func pointer to null in Closure __invoke #12275

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions Zend/zend_closures.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,14 @@ ZEND_METHOD(Closure, __invoke) /* {{{ */
/* destruct the function also, then - we have allocated it in get_method */
zend_string_release_ex(func->internal_function.function_name, 0);
efree(func);
#if ZEND_DEBUG

/* Set the func pointer to NULL. Prior to PHP 8.3, this was only done for debug builds,
* because debug builds check certain properties after the call and needed to know this
* had been freed.
* However, extensions can proxy zend_execute_internal, and it's a bit surprising to have
* an invalid func pointer sitting on there, so this was changed in PHP 8.3.
*/
execute_data->func = NULL;
#endif
}
/* }}} */

Expand Down