From b1bcf79a578945a20eaaedb9ef7831c8a94b3f78 Mon Sep 17 00:00:00 2001 From: Marcel Werk Date: Wed, 6 Mar 2024 16:59:38 +0100 Subject: [PATCH] Improve php version check during the setup Closes #5626 --- wcfsetup/install/files/lib/system/WCFSetup.class.php | 7 ++++++- wcfsetup/setup/lang/setup_de.xml | 2 +- wcfsetup/setup/lang/setup_en.xml | 2 +- wcfsetup/setup/template/stepShowSystemRequirements.tpl | 2 +- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/wcfsetup/install/files/lib/system/WCFSetup.class.php b/wcfsetup/install/files/lib/system/WCFSetup.class.php index f4224a8fd4..8c1b0b1795 100644 --- a/wcfsetup/install/files/lib/system/WCFSetup.class.php +++ b/wcfsetup/install/files/lib/system/WCFSetup.class.php @@ -363,12 +363,15 @@ final class WCFSetup extends WCF */ protected function showSystemRequirements(): ResponseInterface { + $phpVersionLowerBound = '8.1.2'; + $phpVersionUpperBound = '8.3.x'; $system = []; // php version $system['phpVersion']['value'] = \PHP_VERSION; $comparePhpVersion = \preg_replace('/^(\d+\.\d+\.\d+).*$/', '\\1', $system['phpVersion']['value']); - $system['phpVersion']['result'] = (\version_compare($comparePhpVersion, '8.1.2') >= 0); + $system['phpVersion']['result'] = \version_compare($comparePhpVersion, $phpVersionLowerBound, '>=') + && \version_compare($comparePhpVersion, \str_replace('x', '999', $phpVersionUpperBound), '<='); $system['x64']['result'] = \PHP_INT_SIZE == 8; @@ -429,6 +432,8 @@ final class WCFSetup extends WCF [ 'system' => $system, 'nextStep' => 'configureDB', + 'phpVersionLowerBound' => $phpVersionLowerBound, + 'phpVersionUpperBound' => $phpVersionUpperBound, ] ) ); diff --git a/wcfsetup/setup/lang/setup_de.xml b/wcfsetup/setup/lang/setup_de.xml index 0bd1127c1f..ad618846ec 100644 --- a/wcfsetup/setup/lang/setup_de.xml +++ b/wcfsetup/setup/lang/setup_de.xml @@ -20,7 +20,7 @@ - + diff --git a/wcfsetup/setup/lang/setup_en.xml b/wcfsetup/setup/lang/setup_en.xml index 944bb05e1c..cb2ad3f795 100644 --- a/wcfsetup/setup/lang/setup_en.xml +++ b/wcfsetup/setup/lang/setup_en.xml @@ -20,7 +20,7 @@ - + diff --git a/wcfsetup/setup/template/stepShowSystemRequirements.tpl b/wcfsetup/setup/template/stepShowSystemRequirements.tpl index 5e3d0bd954..b148fc9bc4 100644 --- a/wcfsetup/setup/template/stepShowSystemRequirements.tpl +++ b/wcfsetup/setup/template/stepShowSystemRequirements.tpl @@ -10,7 +10,7 @@
{lang}wcf.global.systemRequirements.element.required{/lang}
-
8.1.2
+
{$phpVersionLowerBound} – {$phpVersionUpperBound}
-- 2.20.1