Skip to content

Commit c3f3479

Browse files
committed
- Improved fix for #62384
1 parent 84b1c56 commit c3f3479

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

ext/reflection/php_reflection.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2749,12 +2749,10 @@ ZEND_METHOD(reflection_method, invokeArgs)
27492749
fcc.object_ptr = object;
27502750

27512751
/*
2752-
* Closure::__invoke() actually expects a copy of zend_function, so that it
2753-
* frees it after the invoking.
2752+
* Copy the zend_function when calling via handler (e.g. Closure::__invoke())
27542753
*/
2755-
if (obj_ce == zend_ce_closure && object &&
2756-
strlen(mptr->common.function_name) == sizeof(ZEND_INVOKE_FUNC_NAME)-1 &&
2757-
memcmp(mptr->common.function_name, ZEND_INVOKE_FUNC_NAME, sizeof(ZEND_INVOKE_FUNC_NAME)-1) == 0) {
2754+
if (mptr->type == ZEND_INTERNAL_FUNCTION &&
2755+
(mptr->internal_function.fn_flags & ZEND_ACC_CALL_VIA_HANDLER) != 0) {
27582756
fcc.function_handler = _copy_function(mptr TSRMLS_CC);
27592757
}
27602758

0 commit comments

Comments
 (0)