com php-src: Added test and possible fix for https://bugs.p hp.net/bug.php?id=67068: Zend/zend_clos ures.c ext/reflection/tests/bug67068.phpt
| From: | Stanislav Malyshev | Date: | Tue, 13 Jan 2015 01:24:19 +0000 |
| Subject: | com php-src: Added test and possible fix for https://bugs.p hp.net/bug.php?id=67068: Zend/zend_clos ures.c ext/reflection/tests/bug67068.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-84512@lists.php.net to get a copy of this message | ||
Commit: 1397790560e9b74f514e4a24dea2d870214362a8
Author: Danack <Danack@basereality.com> Tue, 13 Jan 2015 01:24:19 +0000
Parents: 2923f24042877994028ef0e420d8efe768eab7a8
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=1397790560e9b74f514e4a24dea2d870214362a8
Log:
Added test and possible fix for https://bugs.php.net/bug.php?id=67068
Changed paths:
M Zend/zend_closures.c
A ext/reflection/tests/bug67068.phpt
Diff:
diff --git a/Zend/zend_closures.c b/Zend/zend_closures.c
index 0812724..2ec8383 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 0000000..35c1b16
--- /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