[xdebug-dev] xdebug xdebug/php_xdebug.h xdebug/xdebug.c xdebug/xdebug_handler_gdb.c xdebug/xdebug_superglobals.c xdebug/xdebug_var.c xdebug/xdebug_var.h xdebug/tests/call_user_func_array.phpt xdebug/tests/call_user_func_array2.phpt xdebug/tests/test12.phpt xdebug/tests/test6.phpt xdebug/tests/test8.phpt - Partially implemented FR #50: Resource limiting for variable display. By

From: Derick Rethans <derick[@]derickrethans.nl>
Date: Fri, 29 Sep 2006 12:07:17 +0200

Date: Fri Sep 29 12:07:17 CEST 2006
User: Derick Rethans
Directory: xdebug

Log Message:
[4.00]
- Partially implemented FR #50: Resource limiting for variable display. By
  default only two levels of nested variables and max string lengths of 512 are
  shown. These can be changed by setting the ini settings
  xdebug.var_display_max_depth and xdebug.var_display_max_data.

Modified files:
           xdebug/php_xdebug.h (version: 1.115)
           xdebug/xdebug.c (version: 1.346)
           xdebug/xdebug_handler_gdb.c (version: 1.79)
           xdebug/xdebug_superglobals.c (version: 1.18)
           xdebug/xdebug_var.c (version: 1.73)
           xdebug/xdebug_var.h (version: 1.24)
           xdebug/tests/call_user_func_array.phpt (version: 1.14)
           xdebug/tests/call_user_func_array2.phpt (version: 1.14)
           xdebug/tests/test12.phpt (version: 1.15)
           xdebug/tests/test6.phpt (version: 1.16)
           xdebug/tests/test8.phpt (version: 1.17)

[FILE: /xdebug/php_xdebug.h]

===================================================================
RCS file: cvstemp,v
retrieving revision 1.114
retrieving revision 1.115
diff -u -r1.114 -r1.115
--- xdebug/php_xdebug.h:1.114 Mon Sep 25 18:20:01 2006 GMT
+++ xdebug/php_xdebug.h Fri Sep 29 08:07:16 2006 GMT
@@ -146,6 +146,11 @@
         long trace_format;
         char *tracefile_name;
 
+ /* variable dumping limitation settings */
+ long display_max_children;
+ long display_max_data;
+ long display_max_depth;
+
         /* used for code coverage */
         zend_bool do_code_coverage;
         xdebug_hash *code_coverage;

[FILE: /xdebug/xdebug.c]

===================================================================
RCS file: cvstemp,v
retrieving revision 1.345
retrieving revision 1.346
diff -u -r1.345 -r1.346
--- xdebug/xdebug.c:1.345 Tue Sep 26 15:46:22 2006 GMT
+++ xdebug/xdebug.c Fri Sep 29 08:07:16 2006 GMT
@@ -317,6 +317,17 @@
         STD_PHP_INI_ENTRY("xdebug.remote_log", "", PHP_INI_ALL, OnUpdateString, remote_log, zend_xdebug_globals, xdebug_globals)
         PHP_INI_ENTRY("xdebug.allowed_clients", "", PHP_INI_SYSTEM, OnUpdateAllowedClients)
         PHP_INI_ENTRY("xdebug.idekey", "", PHP_INI_ALL, OnUpdateIDEKey)
+
+ /* Variable display settings */
+#if ZEND_EXTENSION_API_NO < 90000000
+/* STD_PHP_INI_ENTRY("xdebug.var_display_max_children", "128", PHP_INI_ALL, OnUpdateInt, display_max_children, zend_xdebug_globals, xdebug_globals) */
+ STD_PHP_INI_ENTRY("xdebug.var_display_max_data", "512", PHP_INI_ALL, OnUpdateInt, display_max_data, zend_xdebug_globals, xdebug_globals)
+ STD_PHP_INI_ENTRY("xdebug.var_display_max_depth", "2", PHP_INI_ALL, OnUpdateInt, display_max_depth, zend_xdebug_globals, xdebug_globals)
+#else
+/* STD_PHP_INI_ENTRY("xdebug.var_display_max_children", "128", PHP_INI_ALL, OnUpdateLong, display_max_children, zend_xdebug_globals, xdebug_globals) */
+ STD_PHP_INI_ENTRY("xdebug.var_display_max_data", "512", PHP_INI_ALL, OnUpdateLong, display_max_data, zend_xdebug_globals, xdebug_globals)
+ STD_PHP_INI_ENTRY("xdebug.var_display_max_depth", "2", PHP_INI_ALL, OnUpdateLong, display_max_depth, zend_xdebug_globals, xdebug_globals)
+#endif
 PHP_INI_END()
 
 static void php_xdebug_init_globals (zend_xdebug_globals *xg TSRMLS_DC)
@@ -1007,7 +1018,7 @@
                 if (tmp->function.type == XFUNC_EVAL) {
                         int is_var;
 
- tmp->include_filename = get_zval_value(get_zval(zdata, &zdata->opline->op1, zdata->Ts, &is_var), 0);
+ tmp->include_filename = get_zval_value(get_zval(zdata, &zdata->opline->op1, zdata->Ts, &is_var), 0, NULL);
                 } else if (XG(collect_includes)) {
                         tmp->include_filename = xdstrdup(zend_get_executed_filename(TSRMLS_C));
                 }
@@ -1519,7 +1530,7 @@
                 return;
         }
         if (html) {
- contents = get_zval_value_fancy(NULL, zvar, &len, 0 TSRMLS_CC);
+ contents = get_zval_value_fancy(NULL, zvar, &len, 0, NULL TSRMLS_CC);
                 if (contents) {
                         php_printf("<tr><td colspan='2' align='right' bgcolor='#ccffcc'>$%s = </td><td bgcolor='#ccffcc'>", name);
                         PHPWRITE(contents, len);
@@ -1528,7 +1539,7 @@
                         php_printf("<tr><td bgcolor='#ccffcc'>$%s</td><td bgcolor='#ccffcc' colspan='2'><i>Undefined</i></td></tr>\n", name);
                 }
         } else {
- contents = get_zval_value(zvar, 0);
+ contents = get_zval_value(zvar, 0, NULL);
                 if (contents) {
                         php_printf(" $%s = %s\n", name, contents);
                 } else {
@@ -1619,10 +1630,10 @@
                                         c = 1;
                                 }
                                 tmp_varname = i->var[j].name ? xdebug_sprintf("$%s = ", i->var[j].name) : xdstrdup("");
- tmp_value = get_zval_value(i->var[j].addr, 0);
+ tmp_value = get_zval_value(i->var[j].addr, 0, NULL);
                                 if (!log_only) {
                                         if (html) {
- tmp_fancy_value = get_zval_value_fancy(tmp_varname, i->var[j].addr, &len, 0 TSRMLS_CC);
+ tmp_fancy_value = get_zval_value_fancy(tmp_varname, i->var[j].addr, &len, 0, NULL TSRMLS_CC);
                                                 PHPWRITE(tmp_fancy_value, len);
                                                 xdfree(tmp_fancy_value);
                                         } else {
@@ -1708,7 +1719,7 @@
         }
         xdebug_str_addl(&str, " >=> ", 7, 0);
 
- tmp_value = get_zval_value(retval, 0);
+ tmp_value = get_zval_value(retval, 0, NULL);
         if (tmp_value) {
                 xdebug_str_add(&str, tmp_value, 1);
         }
@@ -1752,7 +1763,7 @@
                 tmp_varname = i->var[j].name ? xdebug_sprintf("$%s = ", i->var[j].name) : xdstrdup("");
                 xdebug_str_add(&str, tmp_varname, 1);
 
- tmp_value = get_zval_value(i->var[j].addr, 0);
+ tmp_value = get_zval_value(i->var[j].addr, 0, NULL);
                 if (tmp_value) {
                         xdebug_str_add(&str, tmp_value, 1);
                 } else {
@@ -2113,7 +2124,7 @@
                 MAKE_STD_ZVAL(params);
                 array_init(params);
                 for (j = 0; j < i->varc; j++) {
- argument = get_zval_value(i->var[j].addr, 0);
+ argument = get_zval_value(i->var[j].addr, 0, NULL);
                         if (i->var[j].name) {
                                 add_assoc_string_ex(params, i->var[j].name, strlen(i->var[j].name) + 1, argument, 1);
                         } else {
@@ -2283,7 +2294,7 @@
         
         for (i = 0; i < argc; i++) {
                 if (PG(html_errors)) {
- val = get_zval_value_fancy(NULL, (zval*) *args[i], &len, 0 TSRMLS_CC);
+ val = get_zval_value_fancy(NULL, (zval*) *args[i], &len, 0, NULL TSRMLS_CC);
                         PHPWRITE(val, len);
                         xdfree(val);
                 } else {
@@ -2320,10 +2331,10 @@
                         if (debugzval) {
                                 php_printf("%s: ", Z_STRVAL_PP(args[i]));
                                 if (PG(html_errors)) {
- val = get_zval_value_fancy(NULL, debugzval, &len, 1 TSRMLS_CC);
+ val = get_zval_value_fancy(NULL, debugzval, &len, 1, NULL TSRMLS_CC);
                                         PHPWRITE(val, len);
                                 } else {
- val = get_zval_value(debugzval, 1);
+ val = get_zval_value(debugzval, 1, NULL);
                                         PHPWRITE(val, strlen(val));
                                 }
                                 xdfree(val);
@@ -2360,7 +2371,7 @@
                         debugzval = xdebug_get_php_symbol(Z_STRVAL_PP(args[i]), Z_STRLEN_PP(args[i]) + 1);
                         if (debugzval) {
                                 printf("%s: ", Z_STRVAL_PP(args[i]));
- val = get_zval_value(debugzval, 1);
+ val = get_zval_value(debugzval, 1, NULL);
                                 printf("%s(%d)", val, strlen(val));
                                 xdfree(val);
                                 printf("\n");

[FILE: /xdebug/xdebug_handler_gdb.c]

===================================================================
RCS file: cvstemp,v
retrieving revision 1.78
retrieving revision 1.79
diff -u -r1.78 -r1.79
--- xdebug/xdebug_handler_gdb.c:1.78 Sun Jan 01 14:27:27 2006 GMT
+++ xdebug/xdebug_handler_gdb.c Fri Sep 29 08:07:16 2006 GMT
@@ -335,7 +335,7 @@
         switch (options->response_format) {
                    case XDEBUG_RESPONSE_NORMAL:
                         if (val) {
- str_rep = get_zval_value(val, 0);
+ str_rep = get_zval_value(val, 0, xdebug_var_get_nolimit_options());
                         } else {
                                 str_rep = xdstrdup("*uninitialized*");
                         }
@@ -520,7 +520,7 @@
                 if (i->var[j].name) {
                    SENDMSG(h->socket, xdebug_sprintf("$%s = ", i->var[j].name));
                 }
- tmp_value = get_zval_value(i->var[j].addr, 0);
+ tmp_value = get_zval_value(i->var[j].addr, 0, xdebug_var_get_nolimit_options());
                 /* we ignore binary safety here */
                 tmp = xmlize(tmp_value, strlen(tmp_value), &len);
                 SSENDL(h->socket, tmp, len);
@@ -577,7 +577,7 @@
                 if (i->var[j].name) {
                    SENDMSG(h->socket, xdebug_sprintf("$%s = ", i->var[j].name));
                 }
- tmp_value = get_zval_value(i->var[j].addr, 0);
+ tmp_value = get_zval_value(i->var[j].addr, 0, xdebug_var_get_nolimit_options());
                 /* we ignore binary safety here */
                 tmp = xmlize(tmp_value, strlen(tmp_value), &len);
                 SSENDL(h->socket, tmp, len);
@@ -1334,7 +1334,7 @@
 
 char *xdebug_gdb_get_revision(void)
 {
- return "$Revision: 1.78 $";
+ return "$Revision: 1.79 $";
 }
 
 int xdebug_gdb_init(xdebug_con *context, int mode)

[FILE: /xdebug/xdebug_superglobals.c]

===================================================================
RCS file: cvstemp,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- xdebug/xdebug_superglobals.c:1.17 Sun Jan 01 14:27:27 2006 GMT
+++ xdebug/xdebug_superglobals.c Fri Sep 29 08:07:16 2006 GMT
@@ -46,12 +46,12 @@
                 char *val;
 
                 if (html) {
- val = get_zval_value_fancy(NULL, z, &len, 0 TSRMLS_CC);
+ val = get_zval_value_fancy(NULL, z, &len, 0, NULL TSRMLS_CC);
                         php_printf("<td bgcolor='#ffffcc'>");
                         PHPWRITE(val, len);
                         php_printf("</td>");
                 } else {
- val = get_zval_value(z, 0);
+ val = get_zval_value(z, 0, NULL);
                         printf("\n $%s['%s'] = %s", name, elem, val);
                 }
 

[FILE: /xdebug/xdebug_var.c]

===================================================================
RCS file: cvstemp,v
retrieving revision 1.72
retrieving revision 1.73
diff -u -r1.72 -r1.73
--- xdebug/xdebug_var.c:1.72 Wed Aug 02 10:06:55 2006 GMT
+++ xdebug/xdebug_var.c Fri Sep 29 08:07:16 2006 GMT
@@ -123,6 +123,35 @@
 }
 
 
+static xdebug_var_export_options* get_options_from_ini(TSRMLS_D)
+{
+ xdebug_var_export_options *options;
+ options = xdmalloc(sizeof(xdebug_var_export_options));
+
+ options->max_children = 1024; /* XG(display_max_children); */
+ options->max_data = XG(display_max_data);
+ options->max_depth = XG(display_max_depth);
+ options->show_hidden = 0;
+ options->runtime = NULL;
+
+ if (options->max_data < 1) {
+ options->max_data = 1;
+ }
+
+ if (options->max_depth < 0) {
+ options->max_depth = 0;
+ }
+
+ return options;
+}
+
+xdebug_var_export_options xdebug_var_nolimit_options = { 1048576, 1048576, 64, 1, NULL };
+
+xdebug_var_export_options* xdebug_var_get_nolimit_options(TSRMLS_D)
+{
+ return &xdebug_var_nolimit_options;
+}
+
 /*****************************************************************************
 ** Normal variable printing routines
 */
@@ -131,11 +160,13 @@
 {
         int level, debug_zval;
         xdebug_str *str;
+ xdebug_var_export_options *options;
         TSRMLS_FETCH();
 
         level = va_arg(args, int);
         str = va_arg(args, struct xdebug_str*);
         debug_zval = va_arg(args, int);
+ options = va_arg(args, xdebug_var_export_options*);
 
         if (hash_key->nKeyLength==0) { /* numeric key */
                 xdebug_str_add(str, xdebug_sprintf("%ld => ", hash_key->h), 1);
@@ -155,7 +186,7 @@
                 }
                 xdebug_str_add(str, "' => ", 0);
         }
- xdebug_var_export(zv, str, level + 2, debug_zval TSRMLS_CC);
+ xdebug_var_export(zv, str, level + 2, debug_zval, options TSRMLS_CC);
         xdebug_str_addl(str, ", ", 2, 0);
         return 0;
 }
@@ -164,23 +195,25 @@
 {
         int level, debug_zval;
         xdebug_str *str;
+ xdebug_var_export_options *options;
         char *prop_name, *modifier;
         TSRMLS_FETCH();
 
         level = va_arg(args, int);
         str = va_arg(args, struct xdebug_str*);
         debug_zval = va_arg(args, int);
+ options = va_arg(args, xdebug_var_export_options*);
 
         if (hash_key->nKeyLength != 0) {
                 modifier = xdebug_get_property_info(hash_key->arKey, hash_key->nKeyLength, &prop_name);
                 xdebug_str_add(str, xdebug_sprintf("%s $%s = ", modifier, prop_name), 1);
         }
- xdebug_var_export(zv, str, level + 2, debug_zval TSRMLS_CC);
+ xdebug_var_export(zv, str, level + 2, debug_zval, options TSRMLS_CC);
         xdebug_str_addl(str, "; ", 2, 0);
         return 0;
 }
 
-void xdebug_var_export(zval **struc, xdebug_str *str, int level, int debug_zval TSRMLS_DC)
+void xdebug_var_export(zval **struc, xdebug_str *str, int level, int debug_zval, xdebug_var_export_options *options TSRMLS_DC)
 {
         HashTable *myht;
         char* tmp_str;
@@ -211,7 +244,13 @@
 
                 case IS_STRING:
                         tmp_str = php_addcslashes(Z_STRVAL_PP(struc), Z_STRLEN_PP(struc), &tmp_len, 0, "'\\\0..\37", 6 TSRMLS_CC);
- xdebug_str_add(str, xdebug_sprintf("'%s'", tmp_str), 1);
+ if (options->max_data == 0 || Z_STRLEN_PP(struc) <= options->max_data) {
+ xdebug_str_add(str, xdebug_sprintf("'%s'", tmp_str), 1);
+ } else {
+ xdebug_str_addl(str, "'", 1, 0);
+ xdebug_str_addl(str, xdebug_sprintf("%s", tmp_str), options->max_data, 1);
+ xdebug_str_addl(str, "...'", 4, 0);
+ }
                         efree(tmp_str);
                         break;
 
@@ -219,9 +258,13 @@
                         myht = Z_ARRVAL_PP(struc);
                         if (myht->nApplyCount < 1) {
                                 xdebug_str_addl(str, "array (", 7, 0);
- zend_hash_apply_with_arguments(myht, (apply_func_args_t) xdebug_array_element_export, 3, level, str, debug_zval);
- if (myht->nNumOfElements > 0) {
- xdebug_str_chop(str, 2);
+ if (level <= options->max_depth) {
+ zend_hash_apply_with_arguments(myht, (apply_func_args_t) xdebug_array_element_export, 4, level, str, debug_zval, options);
+ if (myht->nNumOfElements > 0) {
+ xdebug_str_chop(str, 2);
+ }
+ } else {
+ xdebug_str_addl(str, "...", 3, 0);
                                 }
                                 xdebug_str_addl(str, ")", 1, 0);
                         } else {
@@ -233,9 +276,13 @@
                         myht = Z_OBJPROP_PP(struc);
                         if (myht->nApplyCount < 1) {
                                 xdebug_str_add(str, xdebug_sprintf("class %s { ", Z_OBJCE_PP(struc)->name), 1);
- zend_hash_apply_with_arguments(myht, (apply_func_args_t) xdebug_object_element_export, 3, level, str, debug_zval);
- if (myht->nNumOfElements > 0) {
- xdebug_str_chop(str, 2);
+ if (level <= options->max_depth) {
+ zend_hash_apply_with_arguments(myht, (apply_func_args_t) xdebug_object_element_export, 4, level, str, debug_zval, options);
+ if (myht->nNumOfElements > 0) {
+ xdebug_str_chop(str, 2);
+ }
+ } else {
+ xdebug_str_addl(str, "...", 3, 0);
                                 }
                                 xdebug_str_addl(str, " }", 2, 0);
                         } else {
@@ -257,12 +304,22 @@
         }
 }
 
-char* get_zval_value(zval *val, int debug_zval)
+char* get_zval_value(zval *val, int debug_zval, xdebug_var_export_options *options)
 {
         xdebug_str str = {0, 0, NULL};
+ int default_options = 0;
         TSRMLS_FETCH();
 
- xdebug_var_export(&val, (xdebug_str*) &str, 1, debug_zval TSRMLS_CC);
+ if (!options) {
+ options = get_options_from_ini(TSRMLS_C);
+ default_options = 1;
+ }
+
+ xdebug_var_export(&val, (xdebug_str*) &str, 1, debug_zval, options TSRMLS_CC);
+
+ if (default_options) {
+ xdfree(options);
+ }
 
         return str.d;
 }
@@ -653,20 +710,22 @@
 {
         int level, debug_zval;
         xdebug_str *str;
+ xdebug_var_export_options *options;
         TSRMLS_FETCH();
 
         level = va_arg(args, int);
         str = va_arg(args, struct xdebug_str*);
         debug_zval = va_arg(args, int);
+ options = va_arg(args, xdebug_var_export_options*);
 
- xdebug_str_add(str, xdebug_sprintf("%*s", level * 2, ""), 1);
+ xdebug_str_add(str, xdebug_sprintf("%*s", (level * 4) - 2, ""), 1);
 
         if (hash_key->nKeyLength==0) { /* numeric key */
                 xdebug_str_add(str, xdebug_sprintf("%ld <font color='%s'>=&gt;</font> ", hash_key->h, DGREY), 1);
         } else { /* string key */
                 xdebug_str_add(str, xdebug_sprintf("'%s' <font color='%s'>=&gt;</font> ", hash_key->arKey, DGREY), 1);
         }
- xdebug_var_export_fancy(zv, str, level + 2, debug_zval TSRMLS_CC);
+ xdebug_var_export_fancy(zv, str, level + 1, debug_zval, options TSRMLS_CC);
 
         return 0;
 }
@@ -675,6 +734,7 @@
 {
         int level, debug_zval;
         xdebug_str *str;
+ xdebug_var_export_options *options;
         char *key;
         char *prop_name, *modifier;
         TSRMLS_FETCH();
@@ -682,19 +742,20 @@
         level = va_arg(args, int);
         str = va_arg(args, struct xdebug_str*);
         debug_zval = va_arg(args, int);
+ options = va_arg(args, xdebug_var_export_options*);
 
- xdebug_str_add(str, xdebug_sprintf("%*s", level * 2, ""), 1);
+ xdebug_str_add(str, xdebug_sprintf("%*s", (level * 4) - 2, ""), 1);
 
         key = hash_key->arKey;
         if (hash_key->nKeyLength != 0) {
                 modifier = xdebug_get_property_info(hash_key->arKey, hash_key->nKeyLength, &prop_name);
                 xdebug_str_add(str, xdebug_sprintf("<i>%s</i> '%s' <font color='%s'>=&gt;</font> ", modifier, prop_name, DGREY), 1);
         }
- xdebug_var_export_fancy(zv, str, level + 2, debug_zval TSRMLS_CC);
+ xdebug_var_export_fancy(zv, str, level + 1, debug_zval, options TSRMLS_CC);
         return 0;
 }
 
-void xdebug_var_export_fancy(zval **struc, xdebug_str *str, int level, int debug_zval TSRMLS_DC)
+void xdebug_var_export_fancy(zval **struc, xdebug_str *str, int level, int debug_zval, xdebug_var_export_options *options TSRMLS_DC)
 {
         HashTable *myht;
         char* tmp_str;
@@ -722,23 +783,35 @@
 
                 case IS_STRING:
                         xdebug_str_add(str, xdebug_sprintf("<font color='%s'>'", PURPLE), 1);
- tmp_str = xmlize(Z_STRVAL_PP(struc), Z_STRLEN_PP(struc), &newlen);
- xdebug_str_addl(str, tmp_str, newlen, 0);
- efree(tmp_str);
- xdebug_str_addl(str, "'</font>", 8, 0);
+ if (Z_STRLEN_PP(struc) > options->max_data) {
+ tmp_str = xmlize(Z_STRVAL_PP(struc), options->max_data, &newlen);
+ xdebug_str_addl(str, tmp_str, newlen, 0);
+ efree(tmp_str);
+ xdebug_str_addl(str, "'...</font>", 11, 0);
+ } else {
+ tmp_str = xmlize(Z_STRVAL_PP(struc), Z_STRLEN_PP(struc), &newlen);
+ xdebug_str_addl(str, tmp_str, newlen, 0);
+ efree(tmp_str);
+ xdebug_str_addl(str, "'</font>", 8, 0);
+ }
                         xdebug_str_add(str, xdebug_sprintf(" <i>(length=%d)</i>", Z_STRLEN_PP(struc)), 1);
                         break;
 
                 case IS_ARRAY:
                         myht = Z_ARRVAL_PP(struc);
- xdebug_str_add(str, xdebug_sprintf("\n%*s", (level - 1) * 2, ""), 1);
+ xdebug_str_add(str, xdebug_sprintf("\n%*s", (level - 1) * 4, ""), 1);
                         if (myht->nApplyCount < 1) {
                                 xdebug_str_addl(str, "<b>array</b>\n", 13, 0);
- if (myht->nNumOfElements) {
- zend_hash_apply_with_arguments(myht, (apply_func_args_t) xdebug_array_element_export_fancy, 3, level, str, debug_zval);
+ if (level <= options->max_depth) {
+ if (myht->nNumOfElements) {
+ zend_hash_apply_with_arguments(myht, (apply_func_args_t) xdebug_array_element_export_fancy, 4, level, str, debug_zval, options);
+ } else {
+ xdebug_str_add(str, xdebug_sprintf("%*s", (level * 4) - 2, ""), 1);
+ xdebug_str_add(str, xdebug_sprintf("<i><font color='%s'>empty</font></i>\n", LGREY), 1);
+ }
                                 } else {
- xdebug_str_add(str, xdebug_sprintf("%*s", level * 2, ""), 1);
- xdebug_str_add(str, xdebug_sprintf("<i><font color='%s'>empty</font></i>\n", LGREY), 1);
+ xdebug_str_add(str, xdebug_sprintf("%*s", (level * 4) - 2, ""), 1);
+ xdebug_str_add(str, xdebug_sprintf("...\n"), 1);
                                 }
                         } else {
                                 xdebug_str_addl(str, "<i>&</i><b>array</b>\n", 21, 0);
@@ -747,7 +820,7 @@
 
                 case IS_OBJECT:
                         myht = Z_OBJPROP_PP(struc);
- xdebug_str_add(str, xdebug_sprintf("\n%*s", (level - 1) * 2, ""), 1);
+ xdebug_str_add(str, xdebug_sprintf("\n%*s", (level - 1) * 4, ""), 1);
                         if (myht->nApplyCount < 1) {
                                 xdebug_str_add(str, xdebug_sprintf("<b>object</b>(<i>%s</i>)", Z_OBJCE_PP(struc)->name), 1);
 #ifdef ZEND_ENGINE_2
@@ -755,7 +828,12 @@
 #else
                                 xdebug_str_addl(str, "\n", 1, 0);
 #endif
- zend_hash_apply_with_arguments(myht, (apply_func_args_t) xdebug_object_element_export_fancy, 3, level, str, debug_zval);
+ if (level <= options->max_depth) {
+ zend_hash_apply_with_arguments(myht, (apply_func_args_t) xdebug_object_element_export_fancy, 4, level, str, debug_zval, options);
+ } else {
+ xdebug_str_add(str, xdebug_sprintf("%*s", (level * 4) - 2, ""), 1);
+ xdebug_str_add(str, xdebug_sprintf("...\n"), 1);
+ }
                         } else {
                                 xdebug_str_add(str, xdebug_sprintf("<i>&</i><b>object</b>(<i>%s</i>)", Z_OBJCE_PP(struc)->name), 1);
 #ifdef ZEND_ENGINE_2
@@ -783,14 +861,24 @@
         }
 }
 
-char* get_zval_value_fancy(char *name, zval *val, int *len, int debug_zval TSRMLS_DC)
+char* get_zval_value_fancy(char *name, zval *val, int *len, int debug_zval, xdebug_var_export_options *options TSRMLS_DC)
 {
         xdebug_str str = {0, 0, NULL};
+ int default_options = 0;
+
+ if (!options) {
+ options = get_options_from_ini(TSRMLS_C);
+ default_options = 1;
+ }
 
         xdebug_str_addl(&str, "<pre>", 5, 0);
- xdebug_var_export_fancy(&val, (xdebug_str*) &str, 1, debug_zval TSRMLS_CC);
+ xdebug_var_export_fancy(&val, (xdebug_str*) &str, 1, debug_zval, options TSRMLS_CC);
         xdebug_str_addl(&str, "</pre>", 6, 0);
 
+ if (default_options) {
+ xdfree(options);
+ }
+
         *len = str.l;
         return str.d;
 }

[FILE: /xdebug/xdebug_var.h]

===================================================================
RCS file: cvstemp,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- xdebug/xdebug_var.h:1.23 Tue Jan 24 20:12:06 2006 GMT
+++ xdebug/xdebug_var.h Fri Sep 29 08:07:16 2006 GMT
@@ -43,16 +43,18 @@
 
 zval* xdebug_get_php_symbol(char* name, int name_length);
 
-void xdebug_var_export(zval **struc, xdebug_str *str, int level, int debug_zval TSRMLS_DC);
+xdebug_var_export_options* xdebug_var_get_nolimit_options(TSRMLS_D);
+
+void xdebug_var_export(zval **struc, xdebug_str *str, int level, int debug_zval, xdebug_var_export_options *options TSRMLS_DC);
 void xdebug_var_export_xml(zval **struc, xdebug_str *str, int level TSRMLS_DC);
-void xdebug_var_export_fancy(zval **struc, xdebug_str *str, int level, int debug_zval TSRMLS_DC);
+void xdebug_var_export_fancy(zval **struc, xdebug_str *str, int level, int debug_zval, xdebug_var_export_options *options TSRMLS_DC);
 void xdebug_var_export_xml_node(zval **struc, char *name, xdebug_xml_node *node, xdebug_var_export_options *options, int level TSRMLS_DC);
 
 char* xmlize(char *string, int len, int *newlen);
 char* error_type (int type);
-char* get_zval_value (zval *val, int debug_zval);
+char* get_zval_value (zval *val, int debug_zval, xdebug_var_export_options *options);
 char* get_zval_value_xml (char *name, zval *val);
-char* get_zval_value_fancy(char *name, zval *val, int *len, int debug_zval TSRMLS_DC);
+char* get_zval_value_fancy(char *name, zval *val, int *len, int debug_zval, xdebug_var_export_options *options TSRMLS_DC);
 xdebug_xml_node* get_zval_value_xml_node (char *name, zval *val, xdebug_var_export_options *options);
 char* show_fname(xdebug_func t, int html, int flags TSRMLS_DC);
 

[FILE: /xdebug/tests/call_user_func_array.phpt]

===================================================================
RCS file: cvstemp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- xdebug/tests/call_user_func_array.phpt:1.13 Mon Jan 02 15:12:31 2006 GMT
+++ xdebug/tests/call_user_func_array.phpt Fri Sep 29 08:07:17 2006 GMT
@@ -11,6 +11,7 @@
 xdebug.profiler_enable=0
 xdebug.show_mem_delta=0
 xdebug.trace_format=0
+xdebug.var_display_max_depth=3
 --FILE--
 <?php
 $tf = xdebug_start_trace('/tmp/'. uniqid('xdt', TRUE));

[FILE: /xdebug/tests/call_user_func_array2.phpt]

===================================================================
RCS file: cvstemp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- xdebug/tests/call_user_func_array2.phpt:1.13 Mon Jan 02 15:12:31 2006 GMT
+++ xdebug/tests/call_user_func_array2.phpt Fri Sep 29 08:07:17 2006 GMT
@@ -11,6 +11,7 @@
 xdebug.profiler_enable=0
 xdebug.show_mem_delta=0
 xdebug.trace_format=0
+xdebug.var_display_max_depth=3
 --FILE--
 <?php
 $tf = xdebug_start_trace('/tmp/'. uniqid('xdt', TRUE));

[FILE: /xdebug/tests/test12.phpt]

===================================================================
RCS file: cvstemp,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- xdebug/tests/test12.phpt:1.14 Mon Jan 02 15:12:31 2006 GMT
+++ xdebug/tests/test12.phpt Fri Sep 29 08:07:17 2006 GMT
@@ -11,6 +11,7 @@
 xdebug.profiler_enable=0
 xdebug.show_mem_delta=0
 xdebug.trace_format=0
+xdebug.var_display_max_depth=3
 --FILE--
 <?php
         $tf = xdebug_start_trace('/tmp/'. uniqid('xdt', TRUE));

[FILE: /xdebug/tests/test6.phpt]

===================================================================
RCS file: cvstemp,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- xdebug/tests/test6.phpt:1.15 Fri Dec 30 13:52:37 2005 GMT
+++ xdebug/tests/test6.phpt Fri Sep 29 08:07:17 2006 GMT
@@ -9,6 +9,7 @@
 xdebug.show_local_vars=1
 xdebug.show_mem_delta=0
 xdebug.profiler_enable=0
+xdebug.var_display_max_depth=3
 --FILE--
 <?php
         function foo2 ($a, $b, $c)

[FILE: /xdebug/tests/test8.phpt]

===================================================================
RCS file: cvstemp,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- xdebug/tests/test8.phpt:1.16 Mon Jan 02 15:12:31 2006 GMT
+++ xdebug/tests/test8.phpt Fri Sep 29 08:07:17 2006 GMT
@@ -11,6 +11,7 @@
 xdebug.profiler_enable=0
 xdebug.show_mem_delta=0
 xdebug.trace_format=0
+xdebug.var_display_max_depth=5
 --FILE--
 <?php
 $tf = xdebug_start_trace('/tmp/'. uniqid('xdt', TRUE));
Received on Fri Sep 29 2006 - 12:07:26 BST

This archive was generated by hypermail 2.2.0 : Sun Jun 24 2018 - 04:00:03 BST