MantisBT

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000304XdebugFeature/Change requestpublic2007-08-21 10:122015-02-22 14:30
Reporterphilipp 
Assigned Toderick 
PrioritynormalSeveritytrivialReproducibilityN/A
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version2.3.0 
Summary0000304: File name and line number info for var_dump()
DescriptionAttached is a tiny patch to add the file name and line number to every call to var_dump()
Additional InformationIndex: 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, "
", 5, 0); 
+    file = zend_get_executed_filename(TSRMLS_C); 
+    lineno = zend_get_executed_lineno(TSRMLS_C); 
+     
+    xdebug_str_addl(&str, "
", 5, 0); 
+    xdebug_str_add(&str, xdebug_sprintf("<small>%s (%i): </small>\n", 
file, lineno), 1); 
        xdebug_var_export_fancy(&val, (xdebug_str*) &str, 1, debug_zval, options TSRMLS_CC); 
        
xdebug_str_addl(&str, "
", 6, 0);
TagsNo tags attached.
Operating System
PHP Version5.2.1
Attached Files

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

-  Notes
(0000719)
derick (administrator)
2007-08-22 20:51

I am not so sure if I want to add this... as this makes even simple var_dump() output quite noisy.
(0000725)
philipp (reporter)
2007-09-17 17:00

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 < argc; i++) {
                if (PG(html_errors)) {
+ file = zend_get_executed_filename(TSRMLS_C);
+ lineno = zend_get_executed_lineno(TSRMLS_C);
+ str = xdebug_sprintf("
<small>%s (%i): </small>
", 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 {
(0002661)
derick (administrator)
2014-01-06 22:30

Implemented for Xdebug 2.3

- Issue History
Date Modified Username Field Change
2007-08-21 10:12 philipp New Issue
2007-08-22 20:51 derick Note Added: 0000719
2007-09-17 17: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


Copyright © 2000 - 2017 MantisBT Team
Powered by Mantis Bugtracker