diff --git a/wcfsetup/install/files/acp/templates/packageList.tpl b/wcfsetup/install/files/acp/templates/packageList.tpl index 4d8224f7f71..11e99e324aa 100644 --- a/wcfsetup/install/files/acp/templates/packageList.tpl +++ b/wcfsetup/install/files/acp/templates/packageList.tpl @@ -54,7 +54,7 @@ {/hascontent} -{if !(80300 <= PHP_VERSION_ID && PHP_VERSION_ID <= 80599)} +{if !((80427 <= PHP_VERSION_ID && PHP_VERSION_ID <= 80499) || (80512 <= PHP_VERSION_ID && PHP_VERSION_ID <= 80599))} {lang}wcf.global.incompatiblePhpVersion{/lang} {/if} {foreach from=$taintedApplications item=$taintedApplication} diff --git a/wcfsetup/install/files/lib/acp/page/SystemCheckPage.class.php b/wcfsetup/install/files/lib/acp/page/SystemCheckPage.class.php index 16fb1fd3914..3798fd32462 100644 --- a/wcfsetup/install/files/lib/acp/page/SystemCheckPage.class.php +++ b/wcfsetup/install/files/lib/acp/page/SystemCheckPage.class.php @@ -94,14 +94,14 @@ class SystemCheckPage extends AbstractPage /** * @var array{ - * minimum: string, + * minimum: list, * deprecated: list, * sufficient: list, * recommended: list, * } */ public $phpVersions = [ - 'minimum' => '8.4.23', + 'minimum' => ['8.4.27', '8.5.12'], 'deprecated' => [], 'sufficient' => ['8.4'], 'recommended' => ['8.5'], @@ -418,8 +418,16 @@ protected function validatePhpVersion() $comparePhpVersion = \preg_replace('/^(\d+\.\d+\.\d+).*$/', '\\1', $phpVersion); // Do not use the "raw" version, it usually contains a lot of noise. $this->results['php']['version']['value'] = $comparePhpVersion; - if (\version_compare($comparePhpVersion, $this->phpVersions['minimum']) >= 0) { - $majorMinor = \preg_replace('~^(\d+\.\d+).*$~', '\\1', $phpVersion); + $majorMinor = \preg_replace('~^(\d+\.\d+).*$~', '\\1', $phpVersion); + $minimumVersion = null; + foreach ($this->phpVersions['minimum'] as $version) { + if (\str_starts_with($version, $majorMinor . '.')) { + $minimumVersion = $version; + break; + } + } + + if ($minimumVersion !== null && \version_compare($comparePhpVersion, $minimumVersion) >= 0) { foreach (['recommended', 'sufficient', 'deprecated'] as $type) { foreach ($this->phpVersions[$type] as $version) { if ($majorMinor === $version) { diff --git a/wcfsetup/install/files/lib/http/middleware/CheckSystemEnvironment.class.php b/wcfsetup/install/files/lib/http/middleware/CheckSystemEnvironment.class.php index c8cee37341b..466d4ba6a86 100644 --- a/wcfsetup/install/files/lib/http/middleware/CheckSystemEnvironment.class.php +++ b/wcfsetup/install/files/lib/http/middleware/CheckSystemEnvironment.class.php @@ -24,8 +24,10 @@ final class CheckSystemEnvironment implements MiddlewareInterface #[\Override] public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface { - // @phpstan-ignore smallerOrEqual.alwaysTrue, smallerOrEqual.alwaysTrue, booleanAnd.alwaysTrue - if (!(80400 <= \PHP_VERSION_ID && \PHP_VERSION_ID <= 80599)) { + if (!( + (80427 <= \PHP_VERSION_ID && \PHP_VERSION_ID <= 80499) + || (80512 <= \PHP_VERSION_ID && \PHP_VERSION_ID <= 80599) // @phpstan-ignore smallerOrEqual.alwaysTrue + )) { if (!RequestHandler::getInstance()->isACPRequest()) { return new HtmlResponse( (new HtmlErrorRenderer())->render( diff --git a/wcfsetup/install/files/lib/system/WCFSetup.class.php b/wcfsetup/install/files/lib/system/WCFSetup.class.php index afe23ed92e3..49297ef52b7 100644 --- a/wcfsetup/install/files/lib/system/WCFSetup.class.php +++ b/wcfsetup/install/files/lib/system/WCFSetup.class.php @@ -363,15 +363,23 @@ protected function showLicense(): ResponseInterface */ protected function showSystemRequirements(): ResponseInterface { - $phpVersionLowerBound = '8.4.23'; - $phpVersionUpperBound = '8.5.x'; + $minimumPhpVersions = ['8.4.27', '8.5.12']; $system = []; // php version $system['phpVersion']['value'] = \PHP_VERSION; $comparePhpVersion = \preg_replace('/^(\d+\.\d+\.\d+).*$/', '\\1', $system['phpVersion']['value']); - $system['phpVersion']['result'] = \version_compare($comparePhpVersion, $phpVersionLowerBound, '>=') - && \version_compare($comparePhpVersion, \str_replace('x', '999', $phpVersionUpperBound), '<='); + $system['phpVersion']['result'] = false; + foreach ($minimumPhpVersions as $minimumVersion) { + $versionPrefix = \preg_replace('~\.\d+$~', '.', $minimumVersion); + if ( + \str_starts_with($comparePhpVersion, $versionPrefix) + && \version_compare($comparePhpVersion, $minimumVersion) >= 0 + ) { + $system['phpVersion']['result'] = true; + break; + } + } $system['x64']['result'] = \PHP_INT_SIZE === 8; @@ -432,8 +440,7 @@ protected function showSystemRequirements(): ResponseInterface [ 'system' => $system, 'nextStep' => 'configureDB', - 'phpVersionLowerBound' => $phpVersionLowerBound, - 'phpVersionUpperBound' => $phpVersionUpperBound, + 'minimumPhpVersions' => $minimumPhpVersions, ] ) ); diff --git a/wcfsetup/install/files/lib/system/acp/dashboard/box/StatusMessageAcpDashboardBox.class.php b/wcfsetup/install/files/lib/system/acp/dashboard/box/StatusMessageAcpDashboardBox.class.php index 96c66d6431e..d1cf8729010 100644 --- a/wcfsetup/install/files/lib/system/acp/dashboard/box/StatusMessageAcpDashboardBox.class.php +++ b/wcfsetup/install/files/lib/system/acp/dashboard/box/StatusMessageAcpDashboardBox.class.php @@ -80,8 +80,10 @@ private function getMessages(): array private function getBasicMessages(): array { $messages = []; - // @phpstan-ignore smallerOrEqual.alwaysTrue, smallerOrEqual.alwaysTrue, booleanAnd.alwaysTrue - if (!(80400 <= \PHP_VERSION_ID && \PHP_VERSION_ID <= 80599)) { + if (!( + (80427 <= \PHP_VERSION_ID && \PHP_VERSION_ID <= 80499) + || (80512 <= \PHP_VERSION_ID && \PHP_VERSION_ID <= 80599) // @phpstan-ignore smallerOrEqual.alwaysTrue + )) { $messages[] = new StatusMessage( StatusMessageType::Error, WCF::getLanguage()->getDynamicVariable('wcf.global.incompatiblePhpVersion') diff --git a/wcfsetup/install/lang/de.xml b/wcfsetup/install/lang/de.xml index 957e7001970..9fed253f6d7 100644 --- a/wcfsetup/install/lang/de.xml +++ b/wcfsetup/install/lang/de.xml @@ -2761,7 +2761,7 @@ Abschnitte dürfen nicht leer sein und nur folgende Zeichen enthalten: [a-z - + @@ -3951,7 +3951,7 @@ Dateianhänge: - + diff --git a/wcfsetup/install/lang/en.xml b/wcfsetup/install/lang/en.xml index 5ce7b52a45a..5da9ee1cfcf 100644 --- a/wcfsetup/install/lang/en.xml +++ b/wcfsetup/install/lang/en.xml @@ -2690,7 +2690,7 @@ If you have already bought the licenses for the listed apps, th - + @@ -3897,7 +3897,7 @@ Attachments: - + diff --git a/wcfsetup/setup/template/stepShowSystemRequirements.tpl b/wcfsetup/setup/template/stepShowSystemRequirements.tpl index 951922c3741..9ee7ef29f04 100644 --- a/wcfsetup/setup/template/stepShowSystemRequirements.tpl +++ b/wcfsetup/setup/template/stepShowSystemRequirements.tpl @@ -10,7 +10,7 @@
{lang}wcf.global.systemRequirements.element.required{/lang}
-
{$phpVersionLowerBound} – {$phpVersionUpperBound}
+
{implode from=$minimumPhpVersions item=$minimumVersion}{$minimumVersion}+{/implode}
diff --git a/wcfsetup/test.php b/wcfsetup/test.php index 2f661766ace..377a46b9c65 100644 --- a/wcfsetup/test.php +++ b/wcfsetup/test.php @@ -26,8 +26,7 @@ 'pdo_mysql', 'zlib', ]; -$phpVersionLowerBound = '8.4.23'; -$phpVersionUpperBound = '8.5.x'; +$minimumPhpVersions = ['8.4.27', '8.5.12']; $phrases = [ 'php_requirements' => [ 'de' => 'PHP', @@ -38,8 +37,8 @@ 'en' => 'PHP version %s', ], 'php_version_failure' => [ - 'de' => 'Gefundene PHP-Version %s ist inkompatibel. PHP %s – %s wird benötigt.', - 'en' => 'PHP version %s is incompatible. PHP %s – %s is required.', + 'de' => 'Gefundene PHP-Version %s ist inkompatibel. Eine der folgenden PHP-Versionen oder neuer innerhalb derselben Versionsreihe wird benötigt: %s.', + 'en' => 'PHP version %s is incompatible. One of the following PHP versions or newer within the same series is required: %s.', ], 'php_x64_success' => [ 'de' => '64-Bit-Unterstützung', @@ -118,12 +117,20 @@ function getPhrase($phrase, array $values = []) } function checkPHPVersion() { - global $phpVersionLowerBound, $phpVersionUpperBound; + global $minimumPhpVersions; $comparePhpVersion = \preg_replace('/^(\d+\.\d+\.\d+).*$/', '\\1', \PHP_VERSION); + foreach ($minimumPhpVersions as $minimumVersion) { + $versionPrefix = \preg_replace('~\.\d+$~', '.', $minimumVersion); + if ( + \str_starts_with($comparePhpVersion, $versionPrefix) + && \version_compare($comparePhpVersion, $minimumVersion) >= 0 + ) { + return true; + } + } - return \version_compare($comparePhpVersion, $phpVersionLowerBound, '>=') - && \version_compare($comparePhpVersion, \str_replace('x', '999', $phpVersionUpperBound), '<='); + return false; } function getMemoryLimit() { @@ -525,7 +532,7 @@ function checkTls()
  • -
  • +