cvs: ZendEngine2 / zend.c zend_compile.c zend_compile.h
| From: | Zeev Suraski | Date: | Sun, 08 Jun 2003 18:53:58 +0000 |
| Subject: | cvs: ZendEngine2 / zend.c zend_compile.c zend_compile.h | ||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-1352@lists.php.net to get a copy of this message | ||
zeev Sun Jun 8 14:53:58 2003 EDT
Modified files:
/ZendEngine2 zend.c zend_compile.c zend_compile.h
Log:
Nicer handling of protected/private members in print_r()
Index: ZendEngine2/zend.c
diff -u ZendEngine2/zend.c:1.235 ZendEngine2/zend.c:1.236
--- ZendEngine2/zend.c:1.235 Wed Jun 4 05:09:47 2003
+++ ZendEngine2/zend.c Sun Jun 8 14:53:58 2003
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend.c,v 1.235 2003/06/04 09:09:47 stas Exp $ */
+/* $Id: zend.c,v 1.236 2003/06/08 18:53:58 zeev Exp $ */
#include "zend.h"
#include "zend_extensions.h"
@@ -112,7 +112,7 @@
#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 @@
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 @@
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 @@
properties->nApplyCount--;
return;
}
- print_hash(properties, indent TSRMLS_CC);
+ print_hash(properties, indent, 1 TSRMLS_CC);
properties->nApplyCount--;
}
break;
Index: ZendEngine2/zend_compile.c
diff -u ZendEngine2/zend_compile.c:1.424 ZendEngine2/zend_compile.c:1.425
--- ZendEngine2/zend_compile.c:1.424 Mon Jun 2 08:13:11 2003
+++ ZendEngine2/zend_compile.c Sun Jun 8 14:53:58 2003
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_compile.c,v 1.424 2003/06/02 12:13:11 stas Exp $ */
+/* $Id: zend_compile.c,v 1.425 2003/06/08 18:53:58 zeev Exp $ */
#include "zend_language_parser.h"
#include "zend.h"
@@ -2356,6 +2356,19 @@
*dest_length = prop_name_length;
}
+
+void unmangle_property_name(char *mangled_property, char **class_name, char **prop_name)
+{
+ *prop_name = *class_name = NULL;
+
+ if (mangled_property[0]!=0) {
+ *prop_name = mangled_property;
+ return;
+ }
+
+ *class_name = mangled_property+1;
+ *prop_name = (*class_name)+strlen(*class_name)+1;
+}
void zend_do_declare_property(znode *var_name, znode *value, zend_uint access_type TSRMLS_DC)
{
Index: ZendEngine2/zend_compile.h
diff -u ZendEngine2/zend_compile.h:1.240 ZendEngine2/zend_compile.h:1.241
--- ZendEngine2/zend_compile.h:1.240 Mon Jun 2 08:13:11 2003
+++ ZendEngine2/zend_compile.h Sun Jun 8 14:53:58 2003
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_compile.h,v 1.240 2003/06/02 12:13:11 stas Exp $ */
+/* $Id: zend_compile.h,v 1.241 2003/06/08 18:53:58 zeev Exp $ */
#ifndef ZEND_COMPILE_H
#define ZEND_COMPILE_H
@@ -455,6 +455,7 @@
ZEND_API void destroy_zend_class(zend_class_entry **pce);
void zend_class_add_ref(zend_class_entry **ce);
+void unmangle_property_name(char *mangled_property, char **prop_name, char **class_name);
void zend_duplicate_property_info(zend_property_info *property_info);
void zend_destroy_property_info(zend_property_info *property_info);