From 1f26e853998650d2d56b596b440ab71bd8773dfc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6nig?= Date: Mon, 13 Jun 2022 15:06:15 +0200 Subject: [PATCH] Exit installer if no valid PHP version is found MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Christian König --- automated install/basic-install.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index bf0bc994..6956484d 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -301,8 +301,13 @@ package_manager_detect() { local phpVer="php" if is_command php ; then printf " %b Existing PHP installation detected : PHP version %s\\n" "${INFO}" "$(php <<< "")" - printf -v phpInsMajor "%d" "$(php <<< "")" - printf -v phpInsMinor "%d" "$(php <<< "")" + printf -v phpInsMajor "$(php <<< "")" + printf -v phpInsMinor "$(php <<< "")" + if [[ "$phpInsMajor" =~ [^[:digit:]] || "$phpInsMinor" =~ [^[:digit:]] ]]; then + printf " %b No valid PHP version detected\\n" "${CROSS}" + # so exit the installer + exit + fi phpVer="php$phpInsMajor.$phpInsMinor" fi # Packages required to perfom the os_check (stored as an array)