MantisBT - Xdebug
View Issue Details
0000971XdebugFeature/Change requestpublic2013-08-22 18:322015-02-22 14:30
RQuadling 
derick 
normalminoralways
closedfixed 
2.2.3 
2.3.0 
Centos
5.4.10-5.4.14
0000971: Cannot use xdebug_get_tracefile_name() output for xdebug_start_trace()
The test script below outputs ...

Thu, 22 Aug 2013 18:28:23 +0100 - XDebug trace file is /tmp/trace.4236609918.xt
Thu, 22 Aug 2013 18:28:23 +0100 - XDebug tracing disabled
Thu, 22 Aug 2013 18:28:23 +0100 - XDebug tracing enabled
Thu, 22 Aug 2013 18:28:23 +0100 - XDebug trace file is /tmp/trace.4236609918.xt.xt

As you can see, the trace filename has an extra '.xt' appended.
<?php
function logger($s_Text){
    echo date('r - '), $s_Text, PHP_EOL;
}

$s_Trace = xdebug_get_tracefile_name();
logger('XDebug trace file is ' . $s_Trace);
xdebug_stop_trace();
logger('XDebug tracing disabled');
xdebug_start_trace($s_Trace, XDEBUG_TRACE_APPEND);
logger('XDebug tracing enabled');
$s_Trace = xdebug_get_tracefile_name();
logger('XDebug trace file is ' . $s_Trace);
?>
Using PHP V5.4.17.
No tags attached.
Issue History
2013-08-22 18:32RQuadlingNew Issue
2013-09-28 14:07derickNote Added: 0002561
2013-09-28 14:07derickAssigned To => derick
2013-09-28 14:07derickStatusnew => feedback
2013-09-29 11:56RQuadlingNote Added: 0002566
2013-09-29 11:56RQuadlingStatusfeedback => assigned
2013-10-14 01:46derickCategoryUsage problems => Feature/Change request
2013-10-14 02:33derickNote Added: 0002585
2013-10-14 02:33derickStatusassigned => closed
2013-10-14 02:33derickResolutionopen => fixed
2013-10-14 02:33derickFixed in Version => 2.3dev
2015-02-22 14:30derickFixed in Version2.3dev => 2.3.0

Notes
(0002561)
derick   
2013-09-28 14:07   
Hi,

This is not a bug, but an unfortunate choice when I implemented the function. xdebug_start_trace() always adds .xt to the end, as is described here: http://xdebug.org/docs/execution_trace#xdebug_start_trace [^]

I will probably want to fix this when Xdebug 3 comes around, but I wouldn't want to break BC for this right now. What I can do, is add another flag, f.e. XDEBUG_TRACE_NAKED_FILENAME so that you don't have to parse and strip out the .xt yourself. Would that work?

cheers,
Derick
(0002566)
RQuadling   
2013-09-29 11:56   
That would be fine. It wasn't until about 2 days ago did I get around to seeing that in the dox (RTFM!).

Currently, I am stripping the .xt off, but that is dangerous as it assumes the extension IS .xt and that the user hasn't decided upon a different name (if that's possible).

So, a flag that allowed xdebug_start_trace() to accept the name as is would certainly be the good for me.

Thanks.

Richard.
(0002585)
derick   
2013-10-14 02:33   
I have added the XDEBUG_TRACE_NAKED_FILENAME option to xdebug_start_trace().