Skip to content

Commit

Permalink
Remove default xdebug options, only set those which are defined
Browse files Browse the repository at this point in the history
  • Loading branch information
trowski committed Jul 23, 2024
1 parent 73d293f commit b4f3978
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/Context/ProcessContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ final class ProcessContext extends AbstractContext
];

private const XDEBUG_OPTIONS = [
"xdebug.mode" => "debug",
"xdebug.start_with_request" => "default",
"xdebug.client_port" => "9003",
"xdebug.client_host" => "localhost",
"xdebug.mode",
"xdebug.start_with_request",
"xdebug.client_port",
"xdebug.client_host",
];

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

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

Expand Down

0 comments on commit b4f3978

Please sign in to comment.