helly           Sat Jan  3 19:08:47 2009 UTC

  Modified files:              (Branch: PHP_5_3)
    /php-src/ext/reflection     php_reflection.c 
  Log:
  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.
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.164.2.33.2.45.2.47&r2=1.164.2.33.2.45.2.48&diff_format=u
Index: php-src/ext/reflection/php_reflection.c
diff -u php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.47 
php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.48
--- php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.47        Sat Jan 
 3 14:20:22 2009
+++ php-src/ext/reflection/php_reflection.c     Sat Jan  3 19:08:47 2009
@@ -20,7 +20,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: php_reflection.c,v 1.164.2.33.2.45.2.47 2009/01/03 14:20:22 helly Exp 
$ */
+/* $Id: php_reflection.c,v 1.164.2.33.2.45.2.48 2009/01/03 19:08:47 helly Exp 
$ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -1550,6 +1550,23 @@
 }
 /* }}} */
 
+/* {{{ 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 @@
 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}
 };
 
@@ -5352,7 +5370,7 @@
        php_info_print_table_start();
        php_info_print_table_header(2, "Reflection", "enabled");
 
-       php_info_print_table_row(2, "Version", "$Revision: 1.164.2.33.2.45.2.47 
$");
+       php_info_print_table_row(2, "Version", "$Revision: 1.164.2.33.2.45.2.48 
$");
 
        php_info_print_table_end();
 } /* }}} */
@@ -5366,7 +5384,7 @@
        NULL,
        NULL,
        PHP_MINFO(reflection),
-       "$Revision: 1.164.2.33.2.45.2.47 $",
+       "$Revision: 1.164.2.33.2.45.2.48 $",
        STANDARD_MODULE_PROPERTIES
 }; /* }}} */
 



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to