diff --git a/Zend/tests/closure_042.phpt b/Zend/tests/closure_042.phpt index dc849a528211b..bd870b50c0c0b 100644 --- a/Zend/tests/closure_042.phpt +++ b/Zend/tests/closure_042.phpt @@ -1,5 +1,5 @@ --TEST-- -Closure 042: Binding an instance to a non-scoped non-static closures gives it a dummy scope +Closure 042: Binding an instance to non-scoped non-static closures --FILE-- obj)) { - closure_func = zend_get_closure_method_def(Z_OBJ(intern->obj)); - if (closure_func && closure_func->common.scope) { - zend_reflection_class_factory(closure_func->common.scope, return_value); + zend_class_entry *called_scope; + zend_function *closure_func; + zend_object *object; + if (Z_OBJ_HANDLER(intern->obj, get_closure) + && Z_OBJ_HANDLER(intern->obj, get_closure)(Z_OBJ(intern->obj), &called_scope, &closure_func, &object, 1) == SUCCESS + && closure_func && (called_scope || closure_func->common.scope)) { + zend_reflection_class_factory(called_scope ? (zend_class_entry *) called_scope : closure_func->common.scope, return_value); } } } diff --git a/ext/reflection/tests/gh8932.phpt b/ext/reflection/tests/gh8932.phpt new file mode 100644 index 0000000000000..e208f92466227 --- /dev/null +++ b/ext/reflection/tests/gh8932.phpt @@ -0,0 +1,24 @@ +--TEST-- +GH-8932 (Wrong closure scope class reported for static methods) +--FILE-- +getClosureScopeClass()); +$d(); +?> +--EXPECTF-- +object(ReflectionClass)#%d (1) { + ["name"]=> + string(1) "B" +} +B