Skip to content

Commit

Permalink
Fixed issue #2251: Xdebug log does not work when using XDEBUG_CONFIG …
Browse files Browse the repository at this point in the history
…environment variable
  • Loading branch information
derickr committed Jul 17, 2024
1 parent f4d312a commit 54ca948
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 5 deletions.
19 changes: 19 additions & 0 deletions tests/debugger/bug02251.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
--TEST--
Test for bug #2251: xdebug.log setting not picked up from XDEBUG_CONFIG
--ENV--
XDEBUG_CONFIG=log={TMP}/{RUNID}{TEST_PHP_WORKER}bug02251.log
--INI--
xdebug.mode=debug,develop
default_charset=utf-8
xdebug.filename_format=
xdebug.client_port=9172
xdebug.start_with_request=yes
xdebug.log=
xdebug.log_level=10
--FILE--
<?php
echo file_get_contents(sys_get_temp_dir() . '/' . getenv('UNIQ_RUN_ID') . getenv('TEST_PHP_WORKER') . 'bug02251.log' );
@unlink (sys_get_temp_dir() . '/' . getenv('UNIQ_RUN_ID') . getenv('TEST_PHP_WORKER') . 'bug02251.log' );
?>
--EXPECTF--
%A[Step Debug] %sTried: localhost:9172 (through xdebug.client_host/xdebug.client_port).
10 changes: 5 additions & 5 deletions xdebug.c
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ static void xdebug_env_config(void)
name = "xdebug.cloud_id";
} else
if (strcasecmp(envvar, "idekey") == 0) {
xdebug_debugger_reset_ide_key(envval);
name = "xdebug.idekey";
} else
if (strcasecmp(envvar, "output_dir") == 0) {
name = "xdebug.output_dir";
Expand Down Expand Up @@ -652,6 +652,10 @@ PHP_RINIT_FUNCTION(xdebug)
return SUCCESS;
}

/* Get xdebug ini entries from the environment also,
this can override the idekey if one is set */
xdebug_env_config();

xdebug_library_rinit();

if (XDEBUG_MODE_IS(XDEBUG_MODE_COVERAGE)) {
Expand All @@ -673,10 +677,6 @@ PHP_RINIT_FUNCTION(xdebug)
xdebug_tracing_rinit();
}

/* Get xdebug ini entries from the environment also,
this can override the idekey if one is set */
xdebug_env_config();

xdebug_init_auto_globals();

/* Only enabled extended info when it is not disabled */
Expand Down

0 comments on commit 54ca948

Please sign in to comment.