diff options
author | Zeev Suraski <zeev@php.net> | 2003-06-08 18:53:58 +0000 |
---|---|---|
committer | Zeev Suraski <zeev@php.net> | 2003-06-08 18:53:58 +0000 |
commit | d329ce93f2bbda9cb72497b0e95ebc608161c9ce (patch) | |
tree | a53cb22d4d038a9e727991e2c793c38ac242766f /Zend/zend.c | |
parent | faefdb7bddccf8cacb42ebda79e2709b661d1594 (diff) | |
download | php-git-d329ce93f2bbda9cb72497b0e95ebc608161c9ce.tar.gz |
Nicer handling of protected/private members in print_r()
Diffstat (limited to 'Zend/zend.c')
-rw-r--r-- | Zend/zend.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/Zend/zend.c b/Zend/zend.c index 8c57996742..b3f415bd26 100644 --- a/Zend/zend.c +++ b/Zend/zend.c @@ -112,7 +112,7 @@ static uint zend_version_info_length; #define PRINT_ZVAL_INDENT 4 -static void print_hash(HashTable *ht, int indent TSRMLS_DC) +static void print_hash(HashTable *ht, int indent, zend_bool is_object TSRMLS_DC) { zval **tmp; char *string_key; @@ -134,7 +134,21 @@ static void print_hash(HashTable *ht, int indent TSRMLS_DC) ZEND_PUTS("["); switch (zend_hash_get_current_key_ex(ht, &string_key, &str_len, &num_key, 0, &iterator)) { case HASH_KEY_IS_STRING: - ZEND_PUTS(string_key); + if (is_object) { + char *prop_name, *class_name; + + unmangle_property_name(string_key, &class_name, &prop_name); + ZEND_PUTS(prop_name); + if (class_name) { + if (class_name[0]=='*') { + ZEND_PUTS(":protected"); + } else { + ZEND_PUTS(":private"); + } + } + } else { + ZEND_PUTS(string_key); + } break; case HASH_KEY_IS_LONG: zend_printf("%ld", num_key); @@ -331,7 +345,7 @@ ZEND_API void zend_print_zval_r_ex(zend_write_func_t write_func, zval *expr, int expr->value.ht->nApplyCount--; return; } - print_hash(expr->value.ht, indent TSRMLS_CC); + print_hash(expr->value.ht, indent, 0 TSRMLS_CC); expr->value.ht->nApplyCount--; break; case IS_OBJECT: @@ -356,7 +370,7 @@ ZEND_API void zend_print_zval_r_ex(zend_write_func_t write_func, zval *expr, int properties->nApplyCount--; return; } - print_hash(properties, indent TSRMLS_CC); + print_hash(properties, indent, 1 TSRMLS_CC); properties->nApplyCount--; } break; |