Permalink
Browse files

Implemented issue #971: The trace file option "XDEBUG_TRACE_NAKED_FIL…

…ENAME"

This option surpresses the automatic .xt extension that is given when you run
"xdebug_start_trace()".
  • Loading branch information...
1 parent bbf7af8 commit f7d19d17662feaa4a5cd10d0866cc4f8fa4d892c @derickr derickr committed Oct 14, 2013
Showing with 34 additions and 5 deletions.
  1. +27 −0 tests/trace_with_naked_filename.phpt
  2. +1 −0 xdebug.c
  3. +4 −3 xdebug_private.h
  4. +2 −2 xdebug_tracing.c
View
27 tests/trace_with_naked_filename.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Test trace with "naked filename"
+--INI--
+xdebug.enable=1
+xdebug.auto_trace=0
+xdebug.collect_params=0
+xdebug.collect_return=0
+xdebug.collect_assignments=0
+xdebug.auto_profile=0
+xdebug.profiler_enable=0
+xdebug.show_mem_delta=0
+xdebug.trace_format=0
+--FILE--
+<?php
+$tf = xdebug_start_trace('/tmp/bug971', XDEBUG_TRACE_COMPUTERIZED);
+echo $tf, "\n";
+unlink($tf);
+xdebug_stop_trace();
+
+$tf = xdebug_start_trace('/tmp/bug971', XDEBUG_TRACE_COMPUTERIZED | XDEBUG_TRACE_NAKED_FILENAME);
+echo $tf, "\n";
+unlink($tf);
+xdebug_stop_trace();
+?>
+--EXPECTF--
+/tmp/bug971.xt
+/tmp/bug971
View
1 xdebug.c
@@ -700,6 +700,7 @@ PHP_MINIT_FUNCTION(xdebug)
REGISTER_LONG_CONSTANT("XDEBUG_TRACE_APPEND", XDEBUG_TRACE_OPTION_APPEND, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("XDEBUG_TRACE_COMPUTERIZED", XDEBUG_TRACE_OPTION_COMPUTERIZED, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("XDEBUG_TRACE_HTML", XDEBUG_TRACE_OPTION_HTML, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XDEBUG_TRACE_NAKED_FILENAME", XDEBUG_TRACE_OPTION_NAKED_FILENAME, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("XDEBUG_CC_UNUSED", XDEBUG_CC_OPTION_UNUSED, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("XDEBUG_CC_DEAD_CODE", XDEBUG_CC_OPTION_DEAD_CODE, CONST_CS | CONST_PERSISTENT);
View
7 xdebug_private.h
@@ -78,9 +78,10 @@ typedef struct xdebug_var {
#define XDEBUG_MAX_FUNCTION_LEN 1024
-#define XDEBUG_TRACE_OPTION_APPEND 1
-#define XDEBUG_TRACE_OPTION_COMPUTERIZED 2
-#define XDEBUG_TRACE_OPTION_HTML 4
+#define XDEBUG_TRACE_OPTION_APPEND 1
+#define XDEBUG_TRACE_OPTION_COMPUTERIZED 2
+#define XDEBUG_TRACE_OPTION_HTML 4
+#define XDEBUG_TRACE_OPTION_NAKED_FILENAME 8
#define XDEBUG_CC_OPTION_UNUSED 1
#define XDEBUG_CC_OPTION_DEAD_CODE 2
View
4 xdebug_tracing.c
@@ -483,9 +483,9 @@ char* xdebug_start_trace(char* fname, long options TSRMLS_DC)
xdfree(fname);
}
if (options & XDEBUG_TRACE_OPTION_APPEND) {
- XG(trace_file) = xdebug_fopen(filename, "a", "xt", (char**) &tmp_fname);
+ XG(trace_file) = xdebug_fopen(filename, "a", (options & XDEBUG_TRACE_OPTION_NAKED_FILENAME) ? NULL : "xt", (char**) &tmp_fname);
} else {
- XG(trace_file) = xdebug_fopen(filename, "w", "xt", (char**) &tmp_fname);
+ XG(trace_file) = xdebug_fopen(filename, "w", (options & XDEBUG_TRACE_OPTION_NAKED_FILENAME) ? NULL : "xt", (char**) &tmp_fname);
}
xdfree(filename);
if (options & XDEBUG_TRACE_OPTION_COMPUTERIZED) {

0 comments on commit f7d19d1

Please sign in to comment.