From 6cdf7ea7e2575f86e8deade6f86a4c41b3bb62a0 Mon Sep 17 00:00:00 2001 From: Dane Powell Date: Mon, 24 Apr 2023 11:34:14 -0700 Subject: [PATCH] Requirement checker fails in Git Bash --- requirement-checker/src/Terminal.php | 3 ++- res/requirement-checker/src/Terminal.php | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/requirement-checker/src/Terminal.php b/requirement-checker/src/Terminal.php index 2cf1690ee..89bd473f9 100644 --- a/requirement-checker/src/Terminal.php +++ b/requirement-checker/src/Terminal.php @@ -96,7 +96,8 @@ public static function hasSttyAvailable(): bool private static function initDimensions(): void { if ('\\' === DIRECTORY_SEPARATOR) { - if (preg_match('/^(\d+)x(\d+)(?: \((\d+)x(\d+)\))?$/', trim(getenv('ANSICON')), $matches)) { + $ansicon = getenv('ANSICON'); + if (false !== $ansicon && preg_match('/^(\d+)x(\d+)(?: \((\d+)x(\d+)\))?$/', trim($ansicon), $matches)) { // extract [w, H] from "wxh (WxH)" // or [w, h] from "wxh" self::$width = (int) $matches[1]; diff --git a/res/requirement-checker/src/Terminal.php b/res/requirement-checker/src/Terminal.php index 5720bf87b..c95c842bc 100644 --- a/res/requirement-checker/src/Terminal.php +++ b/res/requirement-checker/src/Terminal.php @@ -57,7 +57,8 @@ public static function hasSttyAvailable() : bool private static function initDimensions() : void { if ('\\' === DIRECTORY_SEPARATOR) { - if (preg_match('/^(\\d+)x(\\d+)(?: \\((\\d+)x(\\d+)\\))?$/', trim(getenv('ANSICON')), $matches)) { + $ansicon = getenv('ANSICON'); + if (\false !== $ansicon && preg_match('/^(\\d+)x(\\d+)(?: \\((\\d+)x(\\d+)\\))?$/', trim($ansicon), $matches)) { self::$width = (int) $matches[1]; self::$height = isset($matches[4]) ? (int) $matches[4] : (int) $matches[2]; } elseif (!self::hasVt100Support() && self::hasSttyAvailable()) {