derick Sat Jan 3 08:51:03 2004 EDT Modified files: /php-src NEWS /ZendEngine2 zend.c zend_API.c zend_compile.c zend_compile.h zend_execute.c zend_object_handlers.c zend_reflection_api.c /php-src/ext/standard basic_functions.c var.c Log: - Fixed var_export() to show public, protected and private modifiers properly. - Exported (un)mangle_property_name.
Index: php-src/NEWS diff -u php-src/NEWS:1.1566 php-src/NEWS:1.1567 --- php-src/NEWS:1.1566 Thu Jan 1 22:27:43 2004 +++ php-src/NEWS Sat Jan 3 08:51:00 2004 @@ -1,6 +1,8 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ??? 2004, PHP 5 RC1 +- Fixed var_export() to show public, protected and private modifiers properly. + (Derick) - Fixed problems with longlong values in mysqli. (Georg) - Fixed class name case preserving of user defined classes. (Marcus) - Fixed bug #26762 (unserialize() produces lowercase classnames). (Marcus) Index: ZendEngine2/zend.c diff -u ZendEngine2/zend.c:1.262 ZendEngine2/zend.c:1.263 --- ZendEngine2/zend.c:1.262 Mon Dec 29 16:58:03 2003 +++ ZendEngine2/zend.c Sat Jan 3 08:51:01 2004 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend.c,v 1.262 2003/12/29 21:58:03 helly Exp $ */ +/* $Id: zend.c,v 1.263 2004/01/03 13:51:01 derick Exp $ */ #include "zend.h" #include "zend_extensions.h" @@ -138,7 +138,7 @@ if (is_object) { char *prop_name, *class_name; - unmangle_property_name(string_key, &class_name, &prop_name); + zend_unmangle_property_name(string_key, &class_name, &prop_name); ZEND_PUTS(prop_name); if (class_name) { if (class_name[0]=='*') { Index: ZendEngine2/zend_API.c diff -u ZendEngine2/zend_API.c:1.231 ZendEngine2/zend_API.c:1.232 --- ZendEngine2/zend_API.c:1.231 Sun Dec 28 11:20:06 2003 +++ ZendEngine2/zend_API.c Sat Jan 3 08:51:01 2004 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_API.c,v 1.231 2003/12/28 16:20:06 helly Exp $ */ +/* $Id: zend_API.c,v 1.232 2004/01/03 13:51:01 derick Exp $ */ #include "zend.h" #include "zend_execute.h" @@ -1763,7 +1763,7 @@ char *priv_name; int priv_name_length; - mangle_property_name(&priv_name, &priv_name_length, ce->name, ce->name_length, name, name_length, ce->type & ZEND_INTERNAL_CLASS); + zend_mangle_property_name(&priv_name, &priv_name_length, ce->name, ce->name_length, name, name_length, ce->type & ZEND_INTERNAL_CLASS); zend_hash_update(target_symbol_table, priv_name, priv_name_length+1, &property, sizeof(zval *), NULL); property_info.name = priv_name; property_info.name_length = priv_name_length; @@ -1773,7 +1773,7 @@ char *prot_name; int prot_name_length; - mangle_property_name(&prot_name, &prot_name_length, "*", 1, name, name_length, ce->type & ZEND_INTERNAL_CLASS); + zend_mangle_property_name(&prot_name, &prot_name_length, "*", 1, name, name_length, ce->type & ZEND_INTERNAL_CLASS); zend_hash_update(target_symbol_table, prot_name, prot_name_length+1, &property, sizeof(zval *), NULL); property_info.name = prot_name; property_info.name_length = prot_name_length; @@ -1784,7 +1784,7 @@ char *prot_name; int prot_name_length; - mangle_property_name(&prot_name, &prot_name_length, "*", 1, name, name_length, ce->type & ZEND_INTERNAL_CLASS); + zend_mangle_property_name(&prot_name, &prot_name_length, "*", 1, name, name_length, ce->type & ZEND_INTERNAL_CLASS); zend_hash_del(target_symbol_table, prot_name, prot_name_length+1); pefree(prot_name, ce->type & ZEND_INTERNAL_CLASS); } Index: ZendEngine2/zend_compile.c diff -u ZendEngine2/zend_compile.c:1.506 ZendEngine2/zend_compile.c:1.507 --- ZendEngine2/zend_compile.c:1.506 Sun Dec 28 10:18:05 2003 +++ ZendEngine2/zend_compile.c Sat Jan 3 08:51:01 2004 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_compile.c,v 1.506 2003/12/28 15:18:05 helly Exp $ */ +/* $Id: zend_compile.c,v 1.507 2004/01/03 13:51:01 derick Exp $ */ #include "zend_language_parser.h" #include "zend.h" @@ -1814,7 +1814,7 @@ char *prot_name; int prot_name_length; - mangle_property_name(&prot_name, &prot_name_length, "*", 1, child_info->name, child_info->name_length, ce->type & ZEND_INTERNAL_CLASS); + zend_mangle_property_name(&prot_name, &prot_name_length, "*", 1, child_info->name, child_info->name_length, ce->type & ZEND_INTERNAL_CLASS); if (child_info->flags & ZEND_ACC_STATIC) { zval **prop; if (zend_hash_find(parent_ce->static_members, prot_name, prot_name_length+1, (void**)&prop) == SUCCESS) { @@ -2421,7 +2421,7 @@ } -void mangle_property_name(char **dest, int *dest_length, char *src1, int src1_length, char *src2, int src2_length, int internal) +ZEND_API void zend_mangle_property_name(char **dest, int *dest_length, char *src1, int src1_length, char *src2, int src2_length, int internal) { char *prop_name; int prop_name_length; @@ -2437,7 +2437,7 @@ } -void unmangle_property_name(char *mangled_property, char **class_name, char **prop_name) +ZEND_API void zend_unmangle_property_name(char *mangled_property, char **class_name, char **prop_name) { *prop_name = *class_name = NULL; Index: ZendEngine2/zend_compile.h diff -u ZendEngine2/zend_compile.h:1.265 ZendEngine2/zend_compile.h:1.266 --- ZendEngine2/zend_compile.h:1.265 Tue Dec 16 06:44:19 2003 +++ ZendEngine2/zend_compile.h Sat Jan 3 08:51:01 2004 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_compile.h,v 1.265 2003/12/16 11:44:19 sebastian Exp $ */ +/* $Id: zend_compile.h,v 1.266 2004/01/03 13:51:01 derick Exp $ */ #ifndef ZEND_COMPILE_H #define ZEND_COMPILE_H @@ -465,8 +465,8 @@ ZEND_API void destroy_zend_class(zend_class_entry **pce); void zend_class_add_ref(zend_class_entry **ce); -void mangle_property_name(char **dest, int *dest_length, char *src1, int src1_length, char *src2, int src2_length, int internal); -void unmangle_property_name(char *mangled_property, char **prop_name, char **class_name); +ZEND_API void zend_mangle_property_name(char **dest, int *dest_length, char *src1, int src1_length, char *src2, int src2_length, int internal); +ZEND_API void zend_unmangle_property_name(char *mangled_property, char **prop_name, char **class_name); #define ZEND_FUNCTION_DTOR (void (*)(void *)) destroy_zend_function #define ZEND_CLASS_DTOR (void (*)(void *)) destroy_zend_class Index: ZendEngine2/zend_execute.c diff -u ZendEngine2/zend_execute.c:1.576 ZendEngine2/zend_execute.c:1.577 --- ZendEngine2/zend_execute.c:1.576 Mon Dec 29 17:01:47 2003 +++ ZendEngine2/zend_execute.c Sat Jan 3 08:51:01 2004 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_execute.c,v 1.576 2003/12/29 22:01:47 helly Exp $ */ +/* $Id: zend_execute.c,v 1.577 2004/01/03 13:51:01 derick Exp $ */ #define ZEND_INTENSIVE_DEBUGGING 0 @@ -3645,7 +3645,7 @@ zend_hash_move_forward(fe_ht); } while (zend_check_property_access(zobj, str_key TSRMLS_CC) != SUCCESS); - unmangle_property_name(str_key, &class_name, &prop_name); + zend_unmangle_property_name(str_key, &class_name, &prop_name); str_key_len = strlen(prop_name); str_key = estrndup(prop_name, str_key_len); str_key_len++; Index: ZendEngine2/zend_object_handlers.c diff -u ZendEngine2/zend_object_handlers.c:1.86 ZendEngine2/zend_object_handlers.c:1.87 --- ZendEngine2/zend_object_handlers.c:1.86 Sat Dec 27 15:16:49 2003 +++ ZendEngine2/zend_object_handlers.c Sat Jan 3 08:51:01 2004 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_object_handlers.c,v 1.86 2003/12/27 20:16:49 helly Exp $ */ +/* $Id: zend_object_handlers.c,v 1.87 2004/01/03 13:51:01 derick Exp $ */ #include "zend.h" #include "zend_globals.h" @@ -248,7 +248,7 @@ char *class_name, *prop_name; zval member; - unmangle_property_name(prop_info_name, &class_name, &prop_name); + zend_unmangle_property_name(prop_info_name, &class_name, &prop_name); ZVAL_STRING(&member, prop_name, 0); property_info = zend_get_property_info(zobj, &member, 1 TSRMLS_CC); if (!property_info) { Index: ZendEngine2/zend_reflection_api.c diff -u ZendEngine2/zend_reflection_api.c:1.78 ZendEngine2/zend_reflection_api.c:1.79 --- ZendEngine2/zend_reflection_api.c:1.78 Mon Dec 22 15:03:01 2003 +++ ZendEngine2/zend_reflection_api.c Sat Jan 3 08:51:01 2004 @@ -19,7 +19,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_reflection_api.c,v 1.78 2003/12/22 20:03:01 helly Exp $ */ +/* $Id: zend_reflection_api.c,v 1.79 2004/01/03 13:51:01 derick Exp $ */ #include "zend.h" #include "zend_API.h" #include "zend_default_classes.h" @@ -616,7 +616,7 @@ string_printf(str, "static "); } - unmangle_property_name(prop->name, &class_name, &prop_name); + zend_unmangle_property_name(prop->name, &class_name, &prop_name); string_printf(str, "$%s", prop_name); } @@ -758,7 +758,7 @@ property_reference *reference; char *class_name, *prop_name; - unmangle_property_name(prop->name, &class_name, &prop_name); + zend_unmangle_property_name(prop->name, &class_name, &prop_name); if (!(prop->flags & ZEND_ACC_PRIVATE)) { /* we have to seach the class hierarchy for this (implicit) public or protected property */ @@ -1866,7 +1866,7 @@ zend_hash_get_current_key_ex(&ce->default_properties, &key, &key_len, &num_index, 0, &pos); zend_hash_move_forward_ex(&ce->default_properties, &pos); - unmangle_property_name(key, &class_name, &prop_name); + zend_unmangle_property_name(key, &class_name, &prop_name); if (class_name && class_name[0] != '*' && strcmp(class_name, ce->name)) { /* filter privates from base classes */ continue; Index: php-src/ext/standard/basic_functions.c diff -u php-src/ext/standard/basic_functions.c:1.650 php-src/ext/standard/basic_functions.c:1.651 --- php-src/ext/standard/basic_functions.c:1.650 Sat Dec 27 16:10:28 2003 +++ php-src/ext/standard/basic_functions.c Sat Jan 3 08:51:02 2004 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: basic_functions.c,v 1.650 2003/12/27 21:10:28 helly Exp $ */ +/* $Id: basic_functions.c,v 1.651 2004/01/03 13:51:02 derick Exp $ */ #include "php.h" #include "php_streams.h" @@ -2564,7 +2564,7 @@ php_start_ob_buffer (NULL, 0, 1 TSRMLS_CC); } - zend_print_pval_r(var, 0 TSRMLS_CC); + zend_print_zval_r(var, 0 TSRMLS_CC); if (i) { php_ob_get_buffer (return_value TSRMLS_CC); Index: php-src/ext/standard/var.c diff -u php-src/ext/standard/var.c:1.178 php-src/ext/standard/var.c:1.179 --- php-src/ext/standard/var.c:1.178 Sun Dec 28 16:56:15 2003 +++ php-src/ext/standard/var.c Sat Jan 3 08:51:02 2004 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: var.c,v 1.178 2003/12/28 21:56:15 derick Exp $ */ +/* $Id: var.c,v 1.179 2004/01/03 13:51:02 derick Exp $ */ /* {{{ includes @@ -310,12 +310,24 @@ static int php_object_element_export(zval **zv, int num_args, va_list args, zend_hash_key *hash_key) { int level; + char *prop_name, *class_name; TSRMLS_FETCH(); level = va_arg(args, int); if (hash_key->nKeyLength != 0) { - php_printf("%*cvar $%s = ", level + 1, ' ', hash_key->arKey); + php_printf("%*c", level + 1, ' '); + zend_unmangle_property_name(hash_key->arKey, &class_name, &prop_name); + if (class_name) { + if (class_name[0] == '*') { + php_printf("protected"); + } else { + php_printf("private"); + } + } else { + php_printf("public"); + } + php_printf(" $%s = ", prop_name); php_var_export(zv, level + 2 TSRMLS_CC); PUTS (";\n"); }
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php