summaryrefslogtreecommitdiff
path: root/ext/reflection/php_reflection.c
diff options
context:
space:
mode:
authorMarcus Boerger <helly@php.net>2009-01-03 20:04:22 +0000
committerMarcus Boerger <helly@php.net>2009-01-03 20:04:22 +0000
commit4ffc3235e3647a8f71546238fae6a9bfed0bb129 (patch)
tree89d6cdf07fd252df7b24c9adbc1173f2f1e639b7 /ext/reflection/php_reflection.c
parentb5d15b297598f65ab6ea08b852e2615eee0be6e8 (diff)
downloadphp-git-4ffc3235e3647a8f71546238fae6a9bfed0bb129.tar.gz
- MFH Show closure's bound as static parameter
Diffstat (limited to 'ext/reflection/php_reflection.c')
-rw-r--r--ext/reflection/php_reflection.c30
1 files changed, 19 insertions, 11 deletions
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c
index 13cabfad8e..d2f5e00e91 100644
--- a/ext/reflection/php_reflection.c
+++ b/ext/reflection/php_reflection.c
@@ -850,24 +850,32 @@ static void _function_string(string *str, zend_function *fptr, zend_class_entry
}
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;
- char* 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 [ %s $this ]\n", indent, ++index, Z_OBJCE_P(closure_this)->name);
+ }
+ if (static_variables) {
+ HashPosition pos;
+ uint key_len;
+ char* 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 [ $%s ]\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);