Do not check other PHP requirements if the PHP version is incompatible in test.php
authorTim Düsterhus <duesterhus@woltlab.com>
Wed, 6 Sep 2023 09:27:27 +0000 (11:27 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Wed, 6 Sep 2023 09:27:27 +0000 (11:27 +0200)
If the PHP version is not compatible, we can't really trust the other results
anyway, because test.php itself might not be compatible with the PHP version in
question and also because a change of PHP version might also change the php.ini
/ loaded extensions.

wcfsetup/test.php

index 5cb2142b716ba7f4ea3ff7c2866dd80230ddfafe..b0c1f1e51210fe77d39f00c8b51b258257638008 100644 (file)
@@ -421,38 +421,38 @@ function checkOpcache()
         <ul class="system-requirements">
             <?php if (checkPHPVersion()) { ?>
                 <li class="success"><?=getPhrase('php_version_success', [\PHP_VERSION])?></li>
-            <?php } else { ?>
-                <li class="failure"><?=getPhrase('php_version_failure', [\PHP_VERSION, $phpVersionLowerBound, $phpVersionUpperBound])?></li>
-            <?php } ?>
 
-            <?php foreach ($requiredExtensions as $extension) { ?>
-                <?php if (\extension_loaded($extension)) { ?>
-                    <li class="success"><?=getPhrase('php_extension_success', [$extension])?></li>
+                <?php foreach ($requiredExtensions as $extension) { ?>
+                    <?php if (\extension_loaded($extension)) { ?>
+                        <li class="success"><?=getPhrase('php_extension_success', [$extension])?></li>
+                    <?php } else { ?>
+                        <li class="failure"><?=getPhrase('php_extension_failure', [$extension])?></li>
+                    <?php } ?>
+                <?php } ?>
+
+                <?php if (\extension_loaded('imagick') && \in_array('WEBP', \Imagick::queryFormats())) { ?>
+                    <li class="success"><?=getPhrase('php_extension_success', ['Imagick'])?></li>
+                <?php } elseif (\extension_loaded('gd')) { ?>
+                    <?php if (!empty(\gd_info()['WebP Support'])) { ?>
+                        <li class="success"><?=getPhrase('php_extension_success', ['GD'])?></li>
+                    <?php } else { ?>
+                        <li class="failure"><?=getPhrase('php_extension_gd_or_imagick_webp_failure', ['GD'])?></li>
+                    <?php } ?>
                 <?php } else { ?>
-                    <li class="failure"><?=getPhrase('php_extension_failure', [$extension])?></li>
+                    <li class="failure"><?=getPhrase('php_extension_gd_or_imagick_failure')?></li>
                 <?php } ?>
-            <?php } ?>
 
-            <?php if (\extension_loaded('imagick') && \in_array('WEBP', \Imagick::queryFormats())) { ?>
-                <li class="success"><?=getPhrase('php_extension_success', ['Imagick'])?></li>
-            <?php } elseif (\extension_loaded('gd')) { ?>
-                <?php if (!empty(\gd_info()['WebP Support'])) { ?>
-                    <li class="success"><?=getPhrase('php_extension_success', ['GD'])?></li>
+                <?php if (checkMemoryLimit()) { ?>
+                    <li class="success"><?=getPhrase('php_memory_limit_success', [formatFilesizeBinary(getMemoryLimit())])?></li>
                 <?php } else { ?>
-                    <li class="failure"><?=getPhrase('php_extension_gd_or_imagick_webp_failure', ['GD'])?></li>
+                    <li class="failure"><?=getPhrase('php_memory_limit_failure', [formatFilesizeBinary(getMemoryLimit())])?></li>
                 <?php } ?>
-            <?php } else { ?>
-                <li class="failure"><?=getPhrase('php_extension_gd_or_imagick_failure')?></li>
-            <?php } ?>
 
-            <?php if (checkMemoryLimit()) { ?>
-                <li class="success"><?=getPhrase('php_memory_limit_success', [formatFilesizeBinary(getMemoryLimit())])?></li>
+                <?php if (!checkOpcache()) { ?>
+                    <li class="failure"><?=getPhrase('php_opcache_failure')?></li>
+                <?php } ?>
             <?php } else { ?>
-                <li class="failure"><?=getPhrase('php_memory_limit_failure', [formatFilesizeBinary(getMemoryLimit())])?></li>
-            <?php } ?>
-
-            <?php if (!checkOpcache()) { ?>
-                <li class="failure"><?=getPhrase('php_opcache_failure')?></li>
+                <li class="failure"><?=getPhrase('php_version_failure', [\PHP_VERSION, $phpVersionLowerBound, $phpVersionUpperBound])?></li>
             <?php } ?>
         </ul>