diff --git a/src/Context/ProcessContext.php b/src/Context/ProcessContext.php index 2b62ac8..64fca30 100644 --- a/src/Context/ProcessContext.php +++ b/src/Context/ProcessContext.php @@ -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. */ @@ -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; + } } }