Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion wcfsetup/install/files/acp/templates/packageList.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
{/hascontent}
</header>

{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))}
<woltlab-core-notice type="error">{lang}wcf.global.incompatiblePhpVersion{/lang}</woltlab-core-notice>
{/if}
{foreach from=$taintedApplications item=$taintedApplication}
Expand Down
16 changes: 12 additions & 4 deletions wcfsetup/install/files/lib/acp/page/SystemCheckPage.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,14 @@ class SystemCheckPage extends AbstractPage

/**
* @var array{
* minimum: string,
* minimum: list<string>,
* deprecated: list<string>,
* sufficient: list<string>,
* recommended: list<string>,
* }
*/
public $phpVersions = [
'minimum' => '8.4.23',
'minimum' => ['8.4.27', '8.5.12'],
'deprecated' => [],
'sufficient' => ['8.4'],
'recommended' => ['8.5'],
Expand Down Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
19 changes: 13 additions & 6 deletions wcfsetup/install/files/lib/system/WCFSetup.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -432,8 +440,7 @@ protected function showSystemRequirements(): ResponseInterface
[
'system' => $system,
'nextStep' => 'configureDB',
'phpVersionLowerBound' => $phpVersionLowerBound,
'phpVersionUpperBound' => $phpVersionUpperBound,
'minimumPhpVersions' => $minimumPhpVersions,
]
)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
4 changes: 2 additions & 2 deletions wcfsetup/install/lang/de.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2761,7 +2761,7 @@ Abschnitte dürfen nicht leer sein und nur folgende Zeichen enthalten: <kbd>[a-z
<item name="wcf.acp.systemCheck.mysql"><![CDATA[MySQL]]></item>
<item name="wcf.acp.systemCheck.directories"><![CDATA[Dateisystem]]></item>
<item name="wcf.acp.systemCheck.php.version"><![CDATA[Version]]></item>
<item name="wcf.acp.systemCheck.php.version.description"><![CDATA[Es wird mindestens PHP {$phpVersions[minimum]} benötigt, empfohlen werden die folgenden Versionsreihen von PHP: {implode from=$phpVersions[recommended] item=$recommended}{$recommended}{/implode}.]]></item>
<item name="wcf.acp.systemCheck.php.version.description"><![CDATA[Eine der folgenden PHP-Versionen oder neuer innerhalb derselben Versionsreihe wird benötigt: {implode from=$phpVersions[minimum] item=$minimum}{$minimum}{/implode}. Empfohlen werden die folgenden Versionsreihen von PHP: {implode from=$phpVersions[recommended] item=$recommended}{$recommended}{/implode}.]]></item>
<item name="wcf.acp.systemCheck.php.version.deprecated"><![CDATA[Die eingesetzte PHP-Version ist stark veraltet und wird nur eingeschränkt unterstützt, ein einwandfreier Betrieb wird mit dieser Version nicht gewährleistet. Es wird dringend empfohlen, auf eine moderne PHP-Version ({implode from=$phpVersions[recommended] item=$recommended}{$recommended}{/implode}) umzustellen.]]></item>
<item name="wcf.acp.systemCheck.mysql.version"><![CDATA[MySQL]]></item>
<item name="wcf.acp.systemCheck.mysql.version.description"><![CDATA[Es wird mindestens MySQL {$mysqlVersions[mysql][8]} bzw. MariaDB {$mysqlVersions[mariadb][10]} benötigt, grundsätzlich wird der Einsatz neuerer Version ausdrücklich empfohlen.]]></item>
Expand Down Expand Up @@ -3951,7 +3951,7 @@ Dateianhänge:
<item name="wcf.global.rss.accessToken.info"><![CDATA[Der Link zum anonymen RSS-Feed enthält nur Inhalte, auf die Gäste Zugriff haben. Der Link zum personalisierten RSS-Feed enthält alle Inhalte, auf die {if LANGUAGE_USE_INFORMAL_VARIANT}du{else}Sie{/if} Zugriff {if LANGUAGE_USE_INFORMAL_VARIANT}hast{else}haben{/if}.]]></item>
<item name="wcf.global.rss.withAccessToken"><![CDATA[Personalisierter RSS-Feed]]></item>
<item name="wcf.global.rss.withoutAccessToken"><![CDATA[Anonymer RSS-Feed]]></item>
<item name="wcf.global.incompatiblePhpVersion"><![CDATA[Fehlerhafte Server-Konfiguration: Die eingesetzte Version von „PHP” ist nicht kompatibel, ein Betrieb ist nicht möglich. Es wird mindestens PHP in Version 8.1 benötigt, unterstützt werden die Versionen bis PHP 8.4. Für den Einsatz höherer PHP-Versionen muss die Software auf eine aktuelle Version umgestellt werden.]]></item>
<item name="wcf.global.incompatiblePhpVersion"><![CDATA[Fehlerhafte Server-Konfiguration: Die eingesetzte Version von „PHP” ist nicht kompatibel, ein Betrieb ist nicht möglich. Es muss eine der in den Systemvoraussetzungen genannten PHP-Versionen verwendet werden. Für den Einsatz höherer PHP-Versionen muss die Software auf eine aktuelle Version umgestellt werden.]]></item>
<item name="wcf.global.snackbar.progress"><![CDATA[{$label}: {#$iteration} von {#$length}]]></item>
<item name="wcf.global.changeShowOrder"><![CDATA[Reihenfolge bearbeiten]]></item>
</category>
Expand Down
4 changes: 2 additions & 2 deletions wcfsetup/install/lang/en.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2690,7 +2690,7 @@ If you have <strong>already bought the licenses for the listed apps</strong>, th
<item name="wcf.acp.systemCheck.mysql"><![CDATA[MySQL]]></item>
<item name="wcf.acp.systemCheck.directories"><![CDATA[Filesystem]]></item>
<item name="wcf.acp.systemCheck.php.version"><![CDATA[Version]]></item>
<item name="wcf.acp.systemCheck.php.version.description"><![CDATA[PHP {$phpVersions[minimum]} or newer is required, the following PHP series are strongly recommended: {implode from=$phpVersions[recommended] item=$recommended}{$recommended}{/implode}.]]></item>
<item name="wcf.acp.systemCheck.php.version.description"><![CDATA[One of the following PHP versions or newer within the same series is required: {implode from=$phpVersions[minimum] item=$minimum}{$minimum}{/implode}. The following PHP series are strongly recommended: {implode from=$phpVersions[recommended] item=$recommended}{$recommended}{/implode}.]]></item>
<item name="wcf.acp.systemCheck.php.version.deprecated"><![CDATA[The PHP version used is severely outdated and has limited support, proper operation is not guaranteed with this version. It is strongly recommended to switch to a modern PHP version ({implode from=$phpVersions[recommended] item=$recommended}{$recommended}{/implode}).]]></item>
<item name="wcf.acp.systemCheck.mysql.version"><![CDATA[MySQL]]></item>
<item name="wcf.acp.systemCheck.mysql.version.description"><![CDATA[MySQL {$mysqlVersions[mysql][8]} or MariaDB {$mysqlVersions[mariadb][10]} are required at minimum, but it’s strongly recommended to always use the latest available version.]]></item>
Expand Down Expand Up @@ -3897,7 +3897,7 @@ Attachments:
<item name="wcf.global.rss.accessToken.info"><![CDATA[The link to the anonymous RSS feed only contains contents that guests can access. The link to the personalized RSS feed contains all contents that you can access.]]></item>
<item name="wcf.global.rss.withAccessToken"><![CDATA[Personalized RSS Feed]]></item>
<item name="wcf.global.rss.withoutAccessToken"><![CDATA[Anonymous RSS Feed]]></item>
<item name="wcf.global.incompatiblePhpVersion"><![CDATA[Bad server configuration: The configured version of “PHP” is not compatible, operation is not possible. At least PHP in version 8.1 is required, versions up to PHP 8.4 are supported. For the use of higher PHP versions the software must be updated to a current version.]]></item>
<item name="wcf.global.incompatiblePhpVersion"><![CDATA[Bad server configuration: The configured version of “PHP” is not compatible, operation is not possible. Please use one of the PHP versions listed in the system requirements. For the use of higher PHP versions the software must be updated to a current version.]]></item>
<item name="wcf.global.snackbar.progress"><![CDATA[{$label}: {#$iteration} of {#$length}]]></item>
<item name="wcf.global.changeShowOrder"><![CDATA[Change Display Order]]></item>
</category>
Expand Down
2 changes: 1 addition & 1 deletion wcfsetup/setup/template/stepShowSystemRequirements.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<div class="row rowColGap formGrid">
<dl class="col-xs-12 col-md-6">
<dt>{lang}wcf.global.systemRequirements.element.required{/lang}</dt>
<dd>{$phpVersionLowerBound} – {$phpVersionUpperBound}</dd>
<dd>{implode from=$minimumPhpVersions item=$minimumVersion}{$minimumVersion}+{/implode}</dd>
</dl>

<dl class="col-xs-12 col-md-6">
Expand Down
23 changes: 15 additions & 8 deletions wcfsetup/test.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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',
Expand Down Expand Up @@ -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()
{
Expand Down Expand Up @@ -525,7 +532,7 @@ function checkTls()
<li class="failure"><?= getPhrase('tls_failure') ?></li>
<?php } ?>
<?php } else { ?>
<li class="failure"><?= getPhrase('php_version_failure', [\PHP_VERSION, $phpVersionLowerBound, $phpVersionUpperBound]) ?></li>
<li class="failure"><?= getPhrase('php_version_failure', [\PHP_VERSION, \implode(', ', $minimumPhpVersions)]) ?></li>
<?php } ?>
</ul>

Expand Down
Loading