helly           Sat Jan  3 20:03:45 2009 UTC

  Modified files:              
    /php-src/ext/reflection     php_reflection.c 
  Log:
  - Show closure's bound  as static parameter
  
http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.335&r2=1.336&diff_format=u
Index: php-src/ext/reflection/php_reflection.c
diff -u php-src/ext/reflection/php_reflection.c:1.335 
php-src/ext/reflection/php_reflection.c:1.336
--- php-src/ext/reflection/php_reflection.c:1.335       Sat Jan  3 19:08:27 2009
+++ php-src/ext/reflection/php_reflection.c     Sat Jan  3 20:03:45 2009
@@ -20,7 +20,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: php_reflection.c,v 1.335 2009/01/03 19:08:27 helly Exp $ */
+/* $Id: php_reflection.c,v 1.336 2009/01/03 20:03:45 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -875,24 +875,32 @@
        }
        if (closure) {
                const zend_function *closure_fptr = 
zend_get_closure_method_def(closure TSRMLS_CC);
+               zval *closure_this = zend_get_closure_this_ptr(closure 
TSRMLS_CC);
+               HashTable *static_variables = NULL;
+               int index = 0, count = closure_this ? 1 : 0;
                if (closure_fptr->type == ZEND_USER_FUNCTION && 
closure_fptr->op_array.static_variables) {
-                       HashTable *static_variables = 
closure_fptr->op_array.static_variables;
-                       HashPosition pos;
-                       uint key_len;
-                       zstr key;
-                       ulong num_index, index = 0;
-                       int count = zend_hash_num_elements(static_variables);
-                       if (count) {
-                               string_printf(str, "\n");
-                               string_printf(str, "%s  - Static Parameters 
[%d] {\n", indent, count);
+                       static_variables = 
closure_fptr->op_array.static_variables;
+                       count += zend_hash_num_elements(static_variables);
+               }
+               if (count) {
+                       string_printf(str, "\n");
+                       string_printf(str, "%s  - Static Parameters [%d] {\n", 
indent, count);
+                       if (closure_this) {
+                               string_printf(str, "%s    Parameter #%d [ %v 
$this ]\n", indent, ++index, Z_OBJCE_P(closure_this)->name);
+                       }
+                       if (static_variables) {
+                               HashPosition pos;
+                               uint key_len;
+                               zstr key;
+                               ulong num_index;
                                
zend_hash_internal_pointer_reset_ex(static_variables, &pos);
                                while (index++ < count) {
                                        
zend_hash_get_current_key_ex(static_variables, &key, &key_len, &num_index, 0, 
&pos);
                                        string_printf(str, "%s    Parameter #%d 
[ $%v ]\n", indent, index++, key);
                                        
zend_hash_move_forward_ex(static_variables, &pos);
-                               }       
-                               string_printf(str, "%s  }\n", indent);
+                               }
                        }
+                       string_printf(str, "%s  }\n", indent);
                }
        }
        string_init(&param_indent);
@@ -5550,7 +5558,7 @@
        php_info_print_table_start();
        php_info_print_table_header(2, "Reflection", "enabled");
 
-       php_info_print_table_row(2, "Version", "$Revision: 1.335 $");
+       php_info_print_table_row(2, "Version", "$Revision: 1.336 $");
 
        php_info_print_table_end();
 } /* }}} */
@@ -5564,7 +5572,7 @@
        NULL,
        NULL,
        PHP_MINFO(reflection),
-       "$Revision: 1.335 $",
+       "$Revision: 1.336 $",
        STANDARD_MODULE_PROPERTIES
 }; /* }}} */
 



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

Reply via email to