summaryrefslogtreecommitdiff
path: root/ext/reflection
diff options
context:
space:
mode:
authorBob Weinand <bobwei9@hotmail.com>2015-10-14 12:07:04 +0200
committerBob Weinand <bobwei9@hotmail.com>2015-10-14 12:07:33 +0200
commit60b4355168cf3185f87d902be3396265132c045f (patch)
treed059b7875a5c0b3eeabd2158642299f276d28d6b /ext/reflection
parent5649b0ccba49a3e1bfb1c1f8f86e42e64f55b362 (diff)
downloadphp-git-60b4355168cf3185f87d902be3396265132c045f.tar.gz
Do not create a fake Closure for real Closures
That is solved by just returning the Closure as is, which is safe due to Closures being immutable objects
Diffstat (limited to 'ext/reflection')
-rw-r--r--ext/reflection/php_reflection.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c
index a095120e18..df905bf5cc 100644
--- a/ext/reflection/php_reflection.c
+++ b/ext/reflection/php_reflection.c
@@ -1762,7 +1762,12 @@ ZEND_METHOD(reflection_function, getClosure)
}
GET_REFLECTION_OBJECT_PTR(fptr);
- zend_create_fake_closure(return_value, fptr, NULL, NULL, NULL);
+ if (!Z_ISUNDEF(intern->obj)) {
+ /* Closures are immutable objects */
+ ZVAL_COPY(return_value, &intern->obj);
+ } else {
+ zend_create_fake_closure(return_value, fptr, NULL, NULL, NULL);
+ }
}
/* }}} */