]> granicus.if.org Git - php/commitdiff
- Improved fix for #62384
authorFelipe Pena <felipensp@gmail.com>
Sat, 23 Jun 2012 18:10:47 +0000 (15:10 -0300)
committerFelipe Pena <felipensp@gmail.com>
Sat, 23 Jun 2012 18:10:47 +0000 (15:10 -0300)
ext/reflection/php_reflection.c

index 966c9a5448ecab2ccbd14d74115723761d5f6c0b..180ce8f91aa817ce709fc88d83d842c7104e3f0d 100644 (file)
@@ -2749,12 +2749,10 @@ ZEND_METHOD(reflection_method, invokeArgs)
        fcc.object_ptr = object;
        
        /* 
-        * Closure::__invoke() actually expects a copy of zend_function, so that it
-        * frees it after the invoking.
+        * Copy the zend_function when calling via handler (e.g. Closure::__invoke())
         */
-       if (obj_ce == zend_ce_closure && object &&
-               strlen(mptr->common.function_name) == sizeof(ZEND_INVOKE_FUNC_NAME)-1 &&
-               memcmp(mptr->common.function_name, ZEND_INVOKE_FUNC_NAME, sizeof(ZEND_INVOKE_FUNC_NAME)-1) == 0) {
+       if (mptr->type == ZEND_INTERNAL_FUNCTION &&
+               (mptr->internal_function.fn_flags & ZEND_ACC_CALL_VIA_HANDLER) != 0) {
                fcc.function_handler = _copy_function(mptr TSRMLS_CC);
        }