Skip to content

Commit 164e3cb

Browse files
Do not set xdebug.mode=off for PHPT process when PHPT file has --INI-- section with xdebug.mode
1 parent 2fd7d43 commit 164e3cb

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/Util/PHP/DefaultJobRunner.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
use function is_resource;
2424
use function proc_close;
2525
use function proc_open;
26+
use function str_starts_with;
2627
use function stream_get_contents;
2728
use function sys_get_temp_dir;
2829
use function tempnam;
@@ -168,6 +169,16 @@ private function buildCommand(Job $job, ?string $file): array
168169
$command = [PHP_BINARY];
169170
$phpSettings = $job->phpSettings();
170171

172+
$xdebugModeConfiguredExplicitly = false;
173+
174+
foreach ($phpSettings as $phpSetting) {
175+
if (str_starts_with($phpSetting, 'xdebug.mode')) {
176+
$xdebugModeConfiguredExplicitly = true;
177+
178+
break;
179+
}
180+
}
181+
171182
if ($runtime->hasPCOV()) {
172183
$pcovSettings = ini_get_all('pcov');
173184

@@ -194,6 +205,7 @@ private function buildCommand(Job $job, ?string $file): array
194205
);
195206

196207
if (
208+
!$xdebugModeConfiguredExplicitly &&
197209
!CodeCoverage::instance()->isActive() &&
198210
xdebug_is_debugger_active() === false &&
199211
!$job->requiresXdebug()

0 commit comments

Comments
 (0)