Index: xdebug.c
===================================================================
--- xdebug.c (revision 3206)
+++ xdebug.c (working copy)
@@ -247,6 +247,7 @@
PHP_INI_BEGIN()
/* Debugger settings */
STD_PHP_INI_BOOLEAN("xdebug.auto_trace", "0", PHP_INI_ALL, OnUpdateBool, auto_trace, zend_xdebug_globals, xdebug_globals)
+ STD_PHP_INI_BOOLEAN("xdebug.trace_enable_trigger", "0", PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateBool, trace_enable_trigger, zend_xdebug_globals, xdebug_globals)
STD_PHP_INI_ENTRY("xdebug.trace_output_dir", XDEBUG_TEMP_DIR, PHP_INI_ALL, OnUpdateString, trace_output_dir, zend_xdebug_globals, xdebug_globals)
STD_PHP_INI_ENTRY("xdebug.trace_output_name", "trace.%c", PHP_INI_ALL, OnUpdateString, trace_output_name, zend_xdebug_globals, xdebug_globals)
STD_PHP_INI_ENTRY("xdebug.trace_format", "0", PHP_INI_ALL, OnUpdateLong, trace_format, zend_xdebug_globals, xdebug_globals)
@@ -1013,7 +1014,28 @@
XG(remote_enabled) = 0;
XG(profiler_enabled) = 0;
XG(breakpoints_allowed) = 1;
- if (XG(auto_trace) && XG(trace_output_dir) && strlen(XG(trace_output_dir))) {
+
+ if (
+ (
+ XG(auto_trace)
+ ||
+ (
+ /* Check for special GET/POST parameter to start the trace */
+ XG(trace_enable_trigger) &&
+ (
+ (
+ PG(http_globals)[TRACK_VARS_GET] &&
+ zend_hash_find(PG(http_globals)[TRACK_VARS_GET]->value.ht, "XDEBUG_TRACE", sizeof("XDEBUG_TRACE"), (void **) &dummy) == SUCCESS
+ ) || (
+ PG(http_globals)[TRACK_VARS_POST] &&
+ zend_hash_find(PG(http_globals)[TRACK_VARS_POST]->value.ht, "XDEBUG_TRACE", sizeof("XDEBUG_TRACE"), (void **) &dummy) == SUCCESS
+ ) || (
+ PG(http_globals)[TRACK_VARS_COOKIE] &&
+ zend_hash_find(PG(http_globals)[TRACK_VARS_COOKIE]->value.ht, "XDEBUG_TRACE", sizeof("XDEBUG_TRACE"), (void **) &dummy) == SUCCESS
+ )
+ )
+ )
+ ) && XG(trace_output_dir) && strlen(XG(trace_output_dir))) {
/* In case we do an auto-trace we are not interested in the return
* value, but we still have to free it. */
xdfree(xdebug_start_trace(NULL, XG(trace_options) TSRMLS_CC));
Index: xdebug.ini
===================================================================
--- xdebug.ini (revision 3206)
+++ xdebug.ini (working copy)
@@ -8,6 +8,13 @@
;xdebug.auto_trace = 0
; --------------------------------------------------------------------------------------------------
+; xdebug.trace_enable_trigger
+; Type: integer, Default value: 0
+; When this setting is set to 1, you can trigger the generation of the tracing of function calls
+; by using the XDEBUG_TRACE GET/POST parameter.
+xdebug.trace_enable_trigger = 0
+
+; --------------------------------------------------------------------------------------------------
; xdebug.collect_includes
; Type: boolean, Default value: 1
; This setting, defaulting to On, controls whether Xdebug should write the filename used in include
Index: php_xdebug.h
===================================================================
--- php_xdebug.h (revision 3206)
+++ php_xdebug.h (working copy)
@@ -163,6 +163,7 @@
FILE *trace_file;
zend_bool do_trace;
zend_bool auto_trace;
+ zend_bool trace_enable_trigger;
char *trace_output_dir;
char *trace_output_name;
long trace_options;