From 5b581c2ed64fa33469ddf4a74b87943e4ef7b786 Mon Sep 17 00:00:00 2001 From: Clemens Schwaighofer Date: Tue, 24 May 2022 13:12:17 +0900 Subject: [PATCH] Fix checkCLI call on false return from php_sapi_name() --- www/lib/CoreLibs/Get/System.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/www/lib/CoreLibs/Get/System.php b/www/lib/CoreLibs/Get/System.php index 17865293..d5d0276c 100644 --- a/www/lib/CoreLibs/Get/System.php +++ b/www/lib/CoreLibs/Get/System.php @@ -102,7 +102,15 @@ class System */ public static function checkCLI(): bool { - return substr(php_sapi_name(), 0, 3) === 'cli' ? true : false; + return substr( + // if return is false, use empty string + (($sapi_name = php_sapi_name()) === false ? + '' : + $sapi_name + ), + 0, + 3 + ) === 'cli' ? true : false; } }