summaryrefslogtreecommitdiff
path: root/ext/reflection/php_reflection.c
diff options
context:
space:
mode:
authorStanislav Malyshev <stas@php.net>2011-09-07 06:46:27 +0000
committerStanislav Malyshev <stas@php.net>2011-09-07 06:46:27 +0000
commit38ff70ef251ed356dabb0996312dcd7939028020 (patch)
tree019ad0177e35c29d8758b728047f08388dfa4361 /ext/reflection/php_reflection.c
parent27d960c585c76c519ab3752f1f7fdaa99919355b (diff)
downloadphp-git-38ff70ef251ed356dabb0996312dcd7939028020.tar.gz
Commit Gustavo's closure rebinding patch as desided by vote
Diffstat (limited to 'ext/reflection/php_reflection.c')
-rw-r--r--ext/reflection/php_reflection.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c
index 1dd8d4a8a2..628f492a21 100644
--- a/ext/reflection/php_reflection.c
+++ b/ext/reflection/php_reflection.c
@@ -1670,6 +1670,27 @@ ZEND_METHOD(reflection_function, getClosureThis)
}
/* }}} */
+/* {{{ proto public ReflectionClass ReflectionFunction::getClosureScopeClass()
+ Returns the scope associated to the closure */
+ZEND_METHOD(reflection_function, getClosureScopeClass)
+{
+ reflection_object *intern;
+ zend_function *fptr;
+ const zend_function *closure_func;
+
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
+ GET_REFLECTION_OBJECT_PTR(fptr);
+ if (intern->obj) {
+ closure_func = zend_get_closure_method_def(intern->obj TSRMLS_CC);
+ if (closure_func && closure_func->common.scope) {
+ zend_reflection_class_factory(closure_func->common.scope, return_value TSRMLS_CC);
+ }
+ }
+}
+/* }}} */
+
/* {{{ proto public mixed ReflectionFunction::getClosure()
Returns a dynamically created closure for the function */
ZEND_METHOD(reflection_function, getClosure)
@@ -5574,6 +5595,7 @@ static const zend_function_entry reflection_function_abstract_functions[] = {
ZEND_ME(reflection_function, isInternal, arginfo_reflection__void, 0)
ZEND_ME(reflection_function, isUserDefined, arginfo_reflection__void, 0)
ZEND_ME(reflection_function, getClosureThis, arginfo_reflection__void, 0)
+ ZEND_ME(reflection_function, getClosureScopeClass, arginfo_reflection__void, 0)
ZEND_ME(reflection_function, getDocComment, arginfo_reflection__void, 0)
ZEND_ME(reflection_function, getEndLine, arginfo_reflection__void, 0)
ZEND_ME(reflection_function, getExtension, arginfo_reflection__void, 0)