[PHP-CVS] cvs: php4 /ext/standard var.c
moriyoshi Sat Mar 29 16:29:23 2003 EDT Modified files: /php4/ext/standard var.c Log: Improved var_dump() and debug_zval_dump() so they also show the namespace of the given object. Index: php4/ext/standard/var.c diff -u php4/ext/standard/var.c:1.158 php4/ext/standard/var.c:1.159 --- php4/ext/standard/var.c:1.158 Mon Mar 10 10:13:32 2003 +++ php4/ext/standard/var.c Sat Mar 29 16:29:22 2003 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: var.c,v 1.158 2003/03/10 15:13:32 andrei Exp $ */ +/* $Id: var.c,v 1.159 2003/03/29 21:29:22 moriyoshi Exp $ */ /* {{{ includes @@ -61,6 +61,7 @@ HashTable *myht = NULL; char *class_name; zend_uint class_name_len; + zend_class_entry *ce; if (level > 1) { php_printf("%*c", level - 1, ' '); @@ -99,9 +100,14 @@ return; } + ce = Z_OBJCE(**struc); + Z_OBJ_HANDLER(**struc, get_class_name)(*struc, &class_name, &class_name_len, 0 TSRMLS_CC); - - php_printf("%sobject(%s)#%d (%d) {\n", COMMON, class_name, Z_OBJ_HANDLE_PP(struc), myht ? zend_hash_num_elements(myht) : 0); + php_printf("%sobject(", COMMON); + if (ce->ns && ce->ns != &CG(global_namespace) && ce->ns->name) { + php_printf("%s::", ce->ns->name); + } + php_printf("%s)#%d (%d) {\n", class_name, Z_OBJ_HANDLE_PP(struc), myht ? zend_hash_num_elements(myht) : 0); head_done: if (myht) { zend_hash_apply_with_arguments(myht, (apply_func_args_t) php_array_element_dump, 1, level); @@ -174,6 +180,7 @@ HashTable *myht = NULL; char *class_name; zend_uint class_name_len; + zend_class_entry *ce; if (level > 1) { php_printf("%*c", level - 1, ' '); @@ -203,8 +210,13 @@ goto head_done; case IS_OBJECT: myht = Z_OBJPROP_PP(struc); + ce = Z_OBJCE(**struc); Z_OBJ_HANDLER(**struc, get_class_name)(*struc, &class_name, &class_name_len, 0 TSRMLS_CC); - php_printf("%sobject(%s)(%d) refcount(%u){\n", COMMON, class_name, myht ? zend_hash_num_elements(myht) : 0, Z_REFCOUNT_PP(struc)); + php_printf("%sobject(", COMMON); + if (ce->ns && ce->ns != &CG(global_namespace) && ce->ns->name) { + php_printf("%s::", ce->ns->name); + } + php_printf("%s)#%d (%d) refcount(%u){\n", class_name, Z_OBJ_HANDLE_PP(struc), myht ? zend_hash_num_elements(myht) : 0, Z_REFCOUNT_PP(struc)); head_done: if (myht) { zend_hash_apply_with_arguments(myht, (apply_func_args_t) zval_array_element_dump, 1, level); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /ext/standard var.c
andrei Mon Mar 10 10:13:33 2003 EDT Modified files: /php4/ext/standard var.c Log: Print the object handle (it's useful). Index: php4/ext/standard/var.c diff -u php4/ext/standard/var.c:1.157 php4/ext/standard/var.c:1.158 --- php4/ext/standard/var.c:1.157 Fri Jan 31 22:52:31 2003 +++ php4/ext/standard/var.c Mon Mar 10 10:13:32 2003 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: var.c,v 1.157 2003/02/01 03:52:31 wez Exp $ */ +/* $Id: var.c,v 1.158 2003/03/10 15:13:32 andrei Exp $ */ /* {{{ includes @@ -101,7 +101,7 @@ Z_OBJ_HANDLER(**struc, get_class_name)(*struc, &class_name, &class_name_len, 0 TSRMLS_CC); - php_printf("%sobject(%s)(%d) {\n", COMMON, class_name, myht ? zend_hash_num_elements(myht) : 0); + php_printf("%sobject(%s)#%d (%d) {\n", COMMON, class_name, Z_OBJ_HANDLE_PP(struc), myht ? zend_hash_num_elements(myht) : 0); head_done: if (myht) { zend_hash_apply_with_arguments(myht, (apply_func_args_t) php_array_element_dump, 1, level); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /ext/standard var.c
wez Fri Jan 31 22:52:32 2003 EDT Modified files: /php4/ext/standard var.c Log: Don't assume that objects have class entries (in the ZE1 sense) when determining the class name. Additionally, don't assume that objects have a properties hash either. Index: php4/ext/standard/var.c diff -u php4/ext/standard/var.c:1.156 php4/ext/standard/var.c:1.157 --- php4/ext/standard/var.c:1.156 Fri Jan 31 11:24:12 2003 +++ php4/ext/standard/var.c Fri Jan 31 22:52:31 2003 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: var.c,v 1.156 2003/01/31 16:24:12 sas Exp $ */ +/* $Id: var.c,v 1.157 2003/02/01 03:52:31 wez Exp $ */ /* {{{ includes @@ -59,6 +59,8 @@ void php_var_dump(zval **struc, int level TSRMLS_DC) { HashTable *myht = NULL; + char *class_name; + zend_uint class_name_len; if (level > 1) { php_printf("%*c", level - 1, ' '); @@ -92,13 +94,18 @@ goto head_done; case IS_OBJECT: myht = Z_OBJPROP_PP(struc); - if (myht->nApplyCount > 1) { + if (myht && myht->nApplyCount > 1) { PUTS("*RECURSION*\n"); return; } - php_printf("%sobject(%s)(%d) {\n", COMMON, Z_OBJCE_PP(struc)->name, zend_hash_num_elements(myht)); + + Z_OBJ_HANDLER(**struc, get_class_name)(*struc, &class_name, +&class_name_len, 0 TSRMLS_CC); + + php_printf("%sobject(%s)(%d) {\n", COMMON, class_name, myht ? +zend_hash_num_elements(myht) : 0); head_done: - zend_hash_apply_with_arguments(myht, (apply_func_args_t) php_array_element_dump, 1, level); + if (myht) { + zend_hash_apply_with_arguments(myht, (apply_func_args_t) +php_array_element_dump, 1, level); + } if (level > 1) { php_printf("%*c", level-1, ' '); } @@ -165,6 +172,8 @@ void php_debug_zval_dump(zval **struc, int level TSRMLS_DC) { HashTable *myht = NULL; + char *class_name; + zend_uint class_name_len; if (level > 1) { php_printf("%*c", level - 1, ' '); @@ -194,9 +203,12 @@ goto head_done; case IS_OBJECT: myht = Z_OBJPROP_PP(struc); - php_printf("%sobject(%s)(%d) refcount(%u){\n", COMMON, Z_OBJCE_PP(struc)->name, zend_hash_num_elements(myht), Z_REFCOUNT_PP(struc)); + Z_OBJ_HANDLER(**struc, get_class_name)(*struc, &class_name, +&class_name_len, 0 TSRMLS_CC); + php_printf("%sobject(%s)(%d) refcount(%u){\n", COMMON, class_name, +myht ? zend_hash_num_elements(myht) : 0, Z_REFCOUNT_PP(struc)); head_done: - zend_hash_apply_with_arguments(myht, (apply_func_args_t) zval_array_element_dump, 1, level); + if (myht) { + zend_hash_apply_with_arguments(myht, (apply_func_args_t) +zval_array_element_dump, 1, level); + } if (level > 1) { php_printf("%*c", level-1, ' '); } @@ -280,6 +292,8 @@ HashTable *myht; char* tmp_str; int tmp_len; + char *class_name; + zend_uint class_name_len; switch (Z_TYPE_PP(struc)) { case IS_BOOL: @@ -318,8 +332,11 @@ if (level > 1) { php_printf("\n%*c", level - 1, ' '); } - php_printf ("class %s {\n", Z_OBJCE_PP(struc)->name); - zend_hash_apply_with_arguments(myht, (apply_func_args_t) php_object_element_export, 1, level); + Z_OBJ_HANDLER(**struc, get_class_name)(*struc, &class_name, +&class_name_len, 0 TSRMLS_CC); + php_printf ("class %s {\n", class_name); + if (myht) { + zend_hash_apply_with_arguments(myht, (apply_func_args_t) +php_object_element_export, 1, level); + } if (level > 1) { php_printf("%*c", level - 1, ' '); } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /ext/standard var.c
sas Fri Jan 31 11:24:12 2003 EDT Modified files: /php4/ext/standard var.c Log: Unbreak $Id tag Index: php4/ext/standard/var.c diff -u php4/ext/standard/var.c:1.155 php4/ext/standard/var.c:1.156 --- php4/ext/standard/var.c:1.155 Sat Jan 18 10:03:01 2003 +++ php4/ext/standard/var.c Fri Jan 31 11:24:12 2003 @@ -18,8 +18,7 @@ +--+ */ -/* $Id: var.c - 1.111 2001/08/06 13:36:08 thies Exp $ */ +/* $Id: var.c,v 1.156 2003/01/31 16:24:12 sas Exp $ */ /* {{{ includes -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /ext/standard var.c
stasSun Jan 12 08:50:18 2003 EDT Modified files: /php4/ext/standard var.c Log: remove unneeded var Index: php4/ext/standard/var.c diff -u php4/ext/standard/var.c:1.152 php4/ext/standard/var.c:1.153 --- php4/ext/standard/var.c:1.152 Tue Dec 31 11:07:57 2002 +++ php4/ext/standard/var.c Sun Jan 12 08:50:17 2003 @@ -60,7 +60,6 @@ void php_var_dump(zval **struc, int level TSRMLS_DC) { HashTable *myht = NULL; - zend_object *object = NULL; if (level > 1) { php_printf("%*c", level - 1, ' '); @@ -93,7 +92,6 @@ php_printf("%sarray(%d) {\n", COMMON, zend_hash_num_elements(myht)); goto head_done; case IS_OBJECT: - object = Z_OBJ_PP(struc); myht = Z_OBJPROP_PP(struc); if (myht->nApplyCount > 1) { PUTS("*RECURSION*\n"); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /ext/standard var.c /ext/standard/tests/array var_export.phpt
derick Fri Oct 11 09:49:20 2002 EDT Added files: /php4/ext/standard/tests/array var_export.phpt Modified files: /php4/ext/standard var.c Log: - Fix problem with var_export when objects with numeric indexes were exported. We now skip those, as there is no way to export valid code for it. Index: php4/ext/standard/var.c diff -u php4/ext/standard/var.c:1.149 php4/ext/standard/var.c:1.150 --- php4/ext/standard/var.c:1.149 Sun Oct 6 08:02:52 2002 +++ php4/ext/standard/var.c Fri Oct 11 09:49:20 2002 @@ -272,9 +272,9 @@ if (hash_key->nKeyLength != 0) { php_printf("%*cvar $%s = ", level + 1, ' ', hash_key->arKey); + php_var_export(zv, level + 2 TSRMLS_CC); + PUTS (";\n"); } - php_var_export(zv, level + 2 TSRMLS_CC); - PUTS (";\n"); return 0; } Index: php4/ext/standard/tests/array/var_export.phpt +++ php4/ext/standard/tests/array/var_export.phpt --TEST-- var_export() and objects with numeric indexes properties --POST-- --GET-- --INI-- --FILE-- "bar"); var_export($a); ?> --EXPECT-- class stdClass { var $foo = 'bar'; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php4 /ext/standard var.c
On Thu, 3 Oct 2002, Yasuo Ohgaki wrote: > yohgaki Thu Oct 3 04:54:45 2002 EDT > > Modified files: > /php4/ext/standardvar.c > Log: > Prevent unwanted fluhsing. Please don't add more hacks, but fix it right. You broke behavior, please revert that. Derick > > > Index: php4/ext/standard/var.c > diff -u php4/ext/standard/var.c:1.145 php4/ext/standard/var.c:1.146 > --- php4/ext/standard/var.c:1.145 Wed Jun 26 03:36:01 2002 > +++ php4/ext/standard/var.c Thu Oct 3 04:54:45 2002 > @@ -342,21 +342,23 @@ > PHP_FUNCTION(var_export) > { > zval *var; > - zend_bool i = 0; > + zend_bool return_output = 0; > > - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|b", &var, &i) == >FAILURE) { > + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|b", &var, >&return_output) == FAILURE) { > return; > } > > - if (i) { > + if (return_output) { > + php_output_set_status(0 TSRMLS_CC); > php_start_ob_buffer (NULL, 0, 1 TSRMLS_CC); > } > > php_var_export(&var, 1 TSRMLS_CC); > > - if (i) { > + if (return_output) { > php_ob_get_buffer (return_value TSRMLS_CC); > php_end_ob_buffer (0, 0 TSRMLS_CC); > + php_output_set_status(1 TSRMLS_CC); > } > } > /* }}} */ > > > > -- > PHP CVS Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- --- Derick Rethans http://derickrethans.nl/ JDI Media Solutions --[ if you hold a unix shell to your ear, do you hear the c? ]- -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /ext/standard var.c
yohgaki Thu Oct 3 04:54:45 2002 EDT Modified files: /php4/ext/standard var.c Log: Prevent unwanted fluhsing. Index: php4/ext/standard/var.c diff -u php4/ext/standard/var.c:1.145 php4/ext/standard/var.c:1.146 --- php4/ext/standard/var.c:1.145 Wed Jun 26 03:36:01 2002 +++ php4/ext/standard/var.c Thu Oct 3 04:54:45 2002 @@ -342,21 +342,23 @@ PHP_FUNCTION(var_export) { zval *var; - zend_bool i = 0; + zend_bool return_output = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|b", &var, &i) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|b", &var, +&return_output) == FAILURE) { return; } - if (i) { + if (return_output) { + php_output_set_status(0 TSRMLS_CC); php_start_ob_buffer (NULL, 0, 1 TSRMLS_CC); } php_var_export(&var, 1 TSRMLS_CC); - if (i) { + if (return_output) { php_ob_get_buffer (return_value TSRMLS_CC); php_end_ob_buffer (0, 0 TSRMLS_CC); + php_output_set_status(1 TSRMLS_CC); } } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php