From 6940210402855e6e285538473290fa1f9ba369da Mon Sep 17 00:00:00 2001 From: David Goodwin Date: Mon, 11 Jan 2021 21:35:54 +0000 Subject: [PATCH] code already depends on php 7.0 return types, so tidy up setup.php to not allow php5.x; remove setup check for phar as this is not required with php 7.0+ --- public/setup.php | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/public/setup.php b/public/setup.php index 4a11d99c..7dc5280a 100644 --- a/public/setup.php +++ b/public/setup.php @@ -501,16 +501,13 @@ function do_software_environment_check() { $phpversion = 'unknown-version'; if ($f_phpversion == 1) { - if (version_compare(phpversion(), '5', '<')) { - $error[] = "Error: Depends on: PHP v5+"; - } elseif (version_compare(phpversion(), '7.0') < 0) { - $phpversion = 5; - $info[] = "Recommended PHP version: >= 7.0, you have " . phpversion() . "; you should upgrade."; + if (version_compare(PHP_VERSION, '7.0.0', '<')) { + $error[] = "Error: Depends on: PHP v7.0+. You must upgrade."; } else { $info[] = "PHP version " . phpversion(); } } else { - $error[] = "Unable to check for PHP version. (missing function: phpversion())"; + $error[] = "Unable to check for PHP version. (PHP_VERSION not found?)"; } // @@ -614,16 +611,6 @@ function do_software_environment_check() { $warn[] = "Warning: Optional dependency 'imap' extension missing, without this you may not be able to automcate creation of subfolders for new mailboxes"; } -// - // If PHP <7.0, require random_compat works. Currently we bundle it via the Phar extension. -// - if (version_compare(phpversion(), "7.0", '<') - && !extension_loaded('Phar') - && $CONF['configured'] - && $CONF['encrypt'] == 'php_crypt') { - $error[] = "PHP before 7.0 requires 'Phar' extension support for secure random_int() function fallback. Either enable the 'Phar' extension, or install the random_compat library files from https://github.com/paragonie/random_compat and include/require them from functions.inc.php"; - $error[] = "PostfixAdmin has bundled lib/random_compat.phar but it's not usable on your installation due to the missing Phar extension."; - } return ['error' => $error, 'warn' => $warn, 'info' => $info];