diff options
-rw-r--r-- | Zend/zend_closures.c | 1 | ||||
-rw-r--r-- | ext/reflection/tests/bug67068.phpt | 18 |
2 files changed, 19 insertions, 0 deletions
diff --git a/Zend/zend_closures.c b/Zend/zend_closures.c index bc193df6f1..24bc6da26b 100644 --- a/Zend/zend_closures.c +++ b/Zend/zend_closures.c @@ -449,6 +449,7 @@ ZEND_API void zend_create_closure(zval *res, zend_function *func, zend_class_ent closure->func = *func; closure->func.common.prototype = NULL; + closure->func.common.fn_flags |= ZEND_ACC_CLOSURE; if ((scope == NULL) && (this_ptr != NULL)) { /* use dummy scope if we're binding an object without specifying a scope */ diff --git a/ext/reflection/tests/bug67068.phpt b/ext/reflection/tests/bug67068.phpt new file mode 100644 index 0000000000..35c1b1674f --- /dev/null +++ b/ext/reflection/tests/bug67068.phpt @@ -0,0 +1,18 @@ +--TEST-- +Bug #67068 (ReflectionFunction::getClosure returns something that doesn't report as a closure) +--FILE-- +<?php +class MyClass { + public function method() {} +} + +$object = new MyClass; +$reflector = new \ReflectionMethod($object, 'method'); +$closure = $reflector->getClosure($object); + +$closureReflector = new \ReflectionFunction($closure); + +var_dump($closureReflector->isClosure()); +?> +--EXPECT-- +bool(true)
\ No newline at end of file |