View Issue Details

IDProjectCategoryView StatusLast Update
0000304XdebugUncategorizedpublic2020-03-12 18:01
Reporterphilipp Assigned Toderick  
PrioritynormalSeverityfeatureReproducibilityN/A
Status closedResolutionfixed 
Fixed in Version2.3.0 
Summary0000304: File name and line number info for var_dump()
Description

Attached is a tiny patch to add the file name and line number to every call to var_dump()

Additional Information

Index: xdebug_var.c
===================================================================
RCS file: /repository/xdebug/xdebug_var.c,v
retrieving revision 1.87
diff -u -p -r1.87 xdebug_var.c
--- xdebug_var.c 20 Jul 2007 13:52:26 -0000 1.87
+++ xdebug_var.c 20 Aug 2007 20:57:57 -0000
@@ -1007,6 +1007,9 @@ void xdebug_var_export_fancy(zval **stru

char xdebug_get_zval_value_fancy(char name, zval val, int len, int debug_zval, xdebug_var_export_options *options TSRMLS_DC)
{

  • char *file;
  • int lineno;
  • xdebug_str str = {0, 0, NULL}; 
    int default_options = 0; 

@@ -1015,7 +1018,11 @@ char xdebug_get_zval_value_fancy(char
default_options = 1;
}

  • xdebug_str_addl(&str, "<pre>", 5, 0);
  • file = zend_get_executed_filename(TSRMLS_C);
  • lineno = zend_get_executed_lineno(TSRMLS_C);
  • xdebug_str_addl(&str, "<pre>", 5, 0);
  • xdebug_str_add(&str, xdebug_sprintf("<small><i>%s (%i): </i></small>\n", file, lineno), 1);
    xdebug_var_export_fancy(&val, (xdebug_str*) &str, 1, debug_zval, options TSRMLS_CC);
    xdebug_str_addl(&str, "</pre>", 6, 0);
TagsNo tags attached.
Operating System
PHP Version5.2.1

Relationships

has duplicate 0000867 resolvedderick Show File Path/Line information where dump was called from 

Activities

derick

2007-08-22 19:51

administrator   ~0000719

I am not so sure if I want to add this... as this makes even simple var_dump() output quite noisy.

philipp

2007-09-17 16:00

reporter   ~0000725

That's true - output gets noisier. Here is an updated version of the patch (the first one displayed line/file infos in stack traces as well)

philipp

Index: xdebug.c
===================================================================
RCS file: /repository/xdebug/xdebug.c,v
retrieving revision 1.407
diff -u -p -r1.407 xdebug.c
--- xdebug.c 23 Aug 2007 19:44:31 -0000 1.407
+++ xdebug.c 27 Aug 2007 06:12:19 -0000
@@ -2635,8 +2635,8 @@ PHP_FUNCTION(xdebug_var_dump)
{
zval ***args;
int argc;

  • int i, len;
  • char *val;
  • int i, len, lineno;
  • char val, str, *file;

    argc = ZEND_NUM_ARGS(); 

@@ -2648,8 +2648,12 @@ PHP_FUNCTION(xdebug_var_dump)

    for (i = 0; i &lt; argc; i++) { 
            if (PG(html_errors)) { 
  • file = zend_get_executed_filename(TSRMLS_C);
  • lineno = zend_get_executed_lineno(TSRMLS_C);
  • str = xdebug_sprintf("<pre><small><i>%s (%i): </i></small></pre>", file, lineno);
    val = xdebug_get_zval_value_fancy(NULL, (zval) args[i], &len, 0, NULL TSRMLS_CC);
  • PHPWRITE(val, len);
  • PHPWRITE(str, strlen(str));
  • PHPWRITE(val, len);
    xdfree(val);
    } else {

derick

2014-01-06 22:30

administrator   ~0002661

Implemented for Xdebug 2.3

Issue History

Date Modified Username Field Change
2007-08-21 09:12 philipp New Issue
2007-08-22 19:51 derick Note Added: 0000719
2007-09-17 16:00 philipp Note Added: 0000725
2014-01-06 22:30 derick Note Added: 0002661
2014-01-06 22:30 derick Status new => closed
2014-01-06 22:30 derick Assigned To => derick
2014-01-06 22:30 derick Resolution open => fixed
2014-01-06 22:30 derick Fixed in Version => 2.3dev
2014-02-27 19:39 derick Relationship added has duplicate 0000867
2015-02-22 14:30 derick Fixed in Version 2.3dev => 2.3.0
2020-03-12 16:55 derick Severity trivial => feature
2020-03-12 18:01 derick Category Feature/Change request => Uncategorized