Skip to content

Commit b4f3978

Browse files
committed
Remove default xdebug options, only set those which are defined
1 parent 73d293f commit b4f3978

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/Context/ProcessContext.php

+9-7
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ final class ProcessContext extends AbstractContext
2929
];
3030

3131
private const XDEBUG_OPTIONS = [
32-
"xdebug.mode" => "debug",
33-
"xdebug.start_with_request" => "default",
34-
"xdebug.client_port" => "9003",
35-
"xdebug.client_host" => "localhost",
32+
"xdebug.mode",
33+
"xdebug.start_with_request",
34+
"xdebug.client_port",
35+
"xdebug.client_host",
3636
];
3737

3838
/** @var non-empty-string|null External version of SCRIPT_PATH if inside a PHAR. */
@@ -222,10 +222,12 @@ private static function buildOptions(): array
222222

223223
// This copies any ini values set via the command line (e.g., a debug run in PhpStorm)
224224
// to the child process, instead of relying only on those set in an ini file.
225-
if (\ini_get("xdebug.mode") !== false) {
226-
foreach (self::XDEBUG_OPTIONS as $option => $defaultValue) {
225+
if (\extension_loaded('xdebug') && \ini_get("xdebug.mode") !== false) {
226+
foreach (self::XDEBUG_OPTIONS as $option) {
227227
$iniValue = \ini_get($option);
228-
$options[$option] = $iniValue === false ? $defaultValue : $iniValue;
228+
if ($iniValue !== false) {
229+
$options[$option] = $iniValue;
230+
}
229231
}
230232
}
231233

0 commit comments

Comments
 (0)