Index: xdebug.c =================================================================== --- xdebug.c (revision 3438) +++ xdebug.c (working copy) @@ -85,7 +85,7 @@ int (*xdebug_orig_header_handler)(sapi_header_struct *h XG_SAPI_HEADER_OP_DC, sapi_headers_struct *s TSRMLS_DC); -static int xdebug_trigger_enabled(int setting, char *var_name); +static int xdebug_trigger_enabled(int setting, char *var_name, char *var_value); zend_function_entry xdebug_functions[] = { PHP_FE(xdebug_get_stack_depth, NULL) @@ -239,6 +239,7 @@ /* 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_enable_trigger_value", "", PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateString, trace_enable_trigger_value, 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) @@ -276,7 +277,8 @@ STD_PHP_INI_BOOLEAN("xdebug.profiler_enable", "0", PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateBool, profiler_enable, zend_xdebug_globals, xdebug_globals) STD_PHP_INI_ENTRY("xdebug.profiler_output_dir", XDEBUG_TEMP_DIR, PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateString, profiler_output_dir, zend_xdebug_globals, xdebug_globals) STD_PHP_INI_ENTRY("xdebug.profiler_output_name", "cachegrind.out.%p", PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateString, profiler_output_name, zend_xdebug_globals, xdebug_globals) - STD_PHP_INI_BOOLEAN("xdebug.profiler_enable_trigger", "0", PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateBool, profiler_enable_trigger, zend_xdebug_globals, xdebug_globals) + STD_PHP_INI_BOOLEAN("xdebug.profiler_enable_trigger", "1", PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateBool, profiler_enable_trigger, zend_xdebug_globals, xdebug_globals) + STD_PHP_INI_ENTRY("xdebug.profiler_enable_trigger_value", "", PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateString, profiler_enable_trigger_value, zend_xdebug_globals, xdebug_globals) STD_PHP_INI_BOOLEAN("xdebug.profiler_append", "0", PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateBool, profiler_append, zend_xdebug_globals, xdebug_globals) STD_PHP_INI_BOOLEAN("xdebug.profiler_aggregate", "0", PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateBool, profiler_aggregate, zend_xdebug_globals, xdebug_globals) @@ -428,6 +430,9 @@ if (strcasecmp(envvar, "profiler_enable_trigger") == 0) { name = "xdebug.profiler_enable_trigger"; } else + if (strcasecmp(envvar, "trace_enable") == 0) { + name = "xdebug.trace_enable"; + } else if (strcasecmp(envvar, "remote_log") == 0) { name = "xdebug.remote_log"; } else @@ -813,7 +818,7 @@ XG(profiler_enabled) = 0; XG(breakpoints_allowed) = 1; if ( - (XG(auto_trace) || xdebug_trigger_enabled(XG(trace_enable_trigger), "XDEBUG_TRACE")) + (XG(auto_trace) || xdebug_trigger_enabled(XG(trace_enable_trigger), "XDEBUG_TRACE", XG(trace_enable_trigger_value))) && XG(trace_output_dir) && strlen(XG(trace_output_dir)) ) { /* In case we do an auto-trace we are not interested in the return @@ -953,9 +958,9 @@ DISPLAY_INI_ENTRIES(); } -static int xdebug_trigger_enabled(int setting, char *var_name) +static int xdebug_trigger_enabled(int setting, char *var_name, char *var_value) { - zval **dummy; + zval **trigger_val; if (!setting) { return 0; @@ -963,14 +968,19 @@ if ( ( - PG(http_globals)[TRACK_VARS_GET] && - zend_hash_find(PG(http_globals)[TRACK_VARS_GET]->value.ht, var_name, strlen(var_name) + 1, (void **) &dummy) == SUCCESS - ) || ( - PG(http_globals)[TRACK_VARS_POST] && - zend_hash_find(PG(http_globals)[TRACK_VARS_POST]->value.ht, var_name, strlen(var_name) + 1, (void **) &dummy) == SUCCESS - ) || ( - PG(http_globals)[TRACK_VARS_COOKIE] && - zend_hash_find(PG(http_globals)[TRACK_VARS_COOKIE]->value.ht, var_name, strlen(var_name) + 1, (void **) &dummy) == SUCCESS + ( + PG(http_globals)[TRACK_VARS_GET] && + zend_hash_find(PG(http_globals)[TRACK_VARS_GET]->value.ht, var_name, strlen(var_name) + 1, (void **) &trigger_val) == SUCCESS + ) || ( + PG(http_globals)[TRACK_VARS_POST] && + zend_hash_find(PG(http_globals)[TRACK_VARS_POST]->value.ht, var_name, strlen(var_name) + 1, (void **) &trigger_val) == SUCCESS + ) || ( + PG(http_globals)[TRACK_VARS_COOKIE] && + zend_hash_find(PG(http_globals)[TRACK_VARS_COOKIE]->value.ht, var_name, strlen(var_name) + 1, (void **) &trigger_val) == SUCCESS + ) + ) && ( + (var_value == 0) || + (strcmp(var_value, Z_STRVAL_PP(trigger_val)) == 0) ) ) { return 1; @@ -1236,7 +1246,7 @@ /* Check for special GET/POST parameter to start profiling */ if ( !XG(profiler_enabled) && - (XG(profiler_enable) || xdebug_trigger_enabled(XG(profiler_enable_trigger), "XDEBUG_PROFILE")) + (XG(profiler_enable) || xdebug_trigger_enabled(XG(profiler_enable_trigger), "XDEBUG_PROFILE", XG(profiler_enable_trigger_value))) ) { if (xdebug_profiler_init(op_array->filename TSRMLS_CC) == SUCCESS) { XG(profiler_enabled) = 1; Index: php_xdebug.h =================================================================== --- php_xdebug.h (revision 3438) +++ php_xdebug.h (working copy) @@ -181,6 +181,7 @@ zend_bool do_trace; zend_bool auto_trace; zend_bool trace_enable_trigger; + char *trace_enable_trigger_value; char *trace_output_dir; char *trace_output_name; long trace_options; @@ -255,6 +256,7 @@ char *profiler_output_dir; char *profiler_output_name; /* "pid" or "crc32" */ zend_bool profiler_enable_trigger; + char *profiler_enable_trigger_value; zend_bool profiler_append; /* profiler globals */