summaryrefslogtreecommitdiff
path: root/ext/reflection/php_reflection.c
diff options
context:
space:
mode:
authorMarcus Boerger <helly@php.net>2009-01-03 19:08:47 +0000
committerMarcus Boerger <helly@php.net>2009-01-03 19:08:47 +0000
commit12df96e0de3c15528d85c3efdd03fe1b1e010648 (patch)
treefce01a04e0f68180190677433a9e47abfd4287ed /ext/reflection/php_reflection.c
parent4651b7f635bcc076ced2610f59f58e6662a84698 (diff)
downloadphp-git-12df96e0de3c15528d85c3efdd03fe1b1e010648.tar.gz
MFH
- Add ReflectionFunctionAbstract::getClosureThis() [DOC] # Returns the this pointer bound to the closure is the relection object # points to closure. Since not all closures have a bound this, the method # cannot be used to differentiate between normal functions/methods and # closures. Instead ReflectionFunctionAbstract::isClosure() has to be used.
Diffstat (limited to 'ext/reflection/php_reflection.c')
-rw-r--r--ext/reflection/php_reflection.c40
1 files changed, 29 insertions, 11 deletions
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c
index 7bef9be798..13cabfad8e 100644
--- a/ext/reflection/php_reflection.c
+++ b/ext/reflection/php_reflection.c
@@ -1550,6 +1550,23 @@ ZEND_METHOD(reflection_function, isClosure)
}
/* }}} */
+/* {{{ proto public bool ReflectionFunction::getClosureThis()
+ Returns this pointer bound to closure */
+ZEND_METHOD(reflection_function, getClosureThis)
+{
+ reflection_object *intern;
+ zend_function *fptr;
+ zval* closure_this;
+
+ METHOD_NOTSTATIC_NUMPARAMS(reflection_function_abstract_ptr, 0);
+ GET_REFLECTION_OBJECT_PTR(fptr);
+ if (intern->obj) {
+ closure_this = zend_get_closure_this_ptr(intern->obj TSRMLS_CC);
+ RETURN_ZVAL(closure_this, 1, 0);
+ }
+}
+/* }}} */
+
/* {{{ proto public bool ReflectionFunction::isInternal()
Returns whether this is an internal function */
ZEND_METHOD(reflection_function, isInternal)
@@ -4927,25 +4944,26 @@ ZEND_END_ARG_INFO()
static const zend_function_entry reflection_function_abstract_functions[] = {
ZEND_ME(reflection, __clone, NULL, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
PHP_ABSTRACT_ME(reflection_function, __toString, NULL)
+ ZEND_ME(reflection_function, inNamespace, NULL, 0)
ZEND_ME(reflection_function, isClosure, NULL, 0)
+ ZEND_ME(reflection_function, isDeprecated, NULL, 0)
ZEND_ME(reflection_function, isInternal, NULL, 0)
ZEND_ME(reflection_function, isUserDefined, NULL, 0)
- ZEND_ME(reflection_function, getName, NULL, 0)
- ZEND_ME(reflection_function, getFileName, NULL, 0)
- ZEND_ME(reflection_function, getStartLine, NULL, 0)
- ZEND_ME(reflection_function, getEndLine, NULL, 0)
+ ZEND_ME(reflection_function, getClosureThis, NULL, 0)
ZEND_ME(reflection_function, getDocComment, NULL, 0)
- ZEND_ME(reflection_function, getStaticVariables, NULL, 0)
- ZEND_ME(reflection_function, returnsReference, NULL, 0)
- ZEND_ME(reflection_function, getParameters, NULL, 0)
- ZEND_ME(reflection_function, getNumberOfParameters, NULL, 0)
- ZEND_ME(reflection_function, getNumberOfRequiredParameters, NULL, 0)
+ ZEND_ME(reflection_function, getEndLine, NULL, 0)
ZEND_ME(reflection_function, getExtension, NULL, 0)
ZEND_ME(reflection_function, getExtensionName, NULL, 0)
- ZEND_ME(reflection_function, isDeprecated, NULL, 0)
- ZEND_ME(reflection_function, inNamespace, NULL, 0)
+ ZEND_ME(reflection_function, getFileName, NULL, 0)
+ ZEND_ME(reflection_function, getName, NULL, 0)
ZEND_ME(reflection_function, getNamespaceName, NULL, 0)
+ ZEND_ME(reflection_function, getNumberOfParameters, NULL, 0)
+ ZEND_ME(reflection_function, getNumberOfRequiredParameters, NULL, 0)
+ ZEND_ME(reflection_function, getParameters, NULL, 0)
ZEND_ME(reflection_function, getShortName, NULL, 0)
+ ZEND_ME(reflection_function, getStartLine, NULL, 0)
+ ZEND_ME(reflection_function, getStaticVariables, NULL, 0)
+ ZEND_ME(reflection_function, returnsReference, NULL, 0)
{NULL, NULL, NULL}
};