]> granicus.if.org Git - php/commitdiff
Merge branch 'PHP-7.2' into PHP-7.3
authorNikita Popov <nikita.ppv@gmail.com>
Thu, 9 May 2019 10:34:46 +0000 (12:34 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Thu, 9 May 2019 10:35:11 +0000 (12:35 +0200)
1  2 
NEWS
ext/reflection/php_reflection.c

diff --cc NEWS
Simple merge
index f30f47f2b7ee4e004e02b835b4793c0aba9dad88,012f23982d9d94728b4da252b9f21f9de8afd4df..c38160297d400447b1b12d5ace6ac3152db864c3
@@@ -4205,12 -4247,25 +4193,24 @@@ ZEND_METHOD(reflection_class, getMethod
        GET_REFLECTION_OBJECT_PTR(ce);
  
        array_init(return_value);
-       zend_hash_apply_with_arguments(&ce->function_table, (apply_func_args_t) _addmethod_va, 4, &ce, return_value, filter, intern->obj);
-       if (Z_TYPE(intern->obj) != IS_UNDEF && instanceof_function(ce, zend_ce_closure)) {
-               zend_function *closure = zend_get_closure_invoke_method(Z_OBJ(intern->obj));
+       zend_hash_apply_with_arguments(&ce->function_table, (apply_func_args_t) _addmethod_va, 4, &ce, return_value, filter);
+       if (instanceof_function(ce, zend_ce_closure)) {
+               zend_bool has_obj = Z_TYPE(intern->obj) != IS_UNDEF;
+               zval obj_tmp;
+               zend_object *obj;
+               if (!has_obj) {
+                       object_init_ex(&obj_tmp, ce);
+                       obj = Z_OBJ(obj_tmp);
+               } else {
+                       obj = Z_OBJ(intern->obj);
+               }
+               zend_function *closure = zend_get_closure_invoke_method(obj);
                if (closure) {
-                       _addmethod(closure, ce, return_value, filter, &intern->obj);
-                       _free_function(closure);
 -                      _fix_closure_prototype(closure);
+                       _addmethod(closure, ce, return_value, filter);
+               }
+               if (!has_obj) {
+                       zval_ptr_dtor(&obj_tmp);
                }
        }
  }