Skip to content

Commit 8fb51d4

Browse files
authored
Set func pointer to null in Closure __invoke (#12275)
1 parent 5e8c992 commit 8fb51d4

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

Zend/zend_closures.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,14 @@ ZEND_METHOD(Closure, __invoke) /* {{{ */
5858
/* destruct the function also, then - we have allocated it in get_method */
5959
zend_string_release_ex(func->internal_function.function_name, 0);
6060
efree(func);
61-
#if ZEND_DEBUG
61+
62+
/* Set the func pointer to NULL. Prior to PHP 8.3, this was only done for debug builds,
63+
* because debug builds check certain properties after the call and needed to know this
64+
* had been freed.
65+
* However, extensions can proxy zend_execute_internal, and it's a bit surprising to have
66+
* an invalid func pointer sitting on there, so this was changed in PHP 8.3.
67+
*/
6268
execute_data->func = NULL;
63-
#endif
6469
}
6570
/* }}} */
6671

0 commit comments

Comments
 (0)