diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc index 68dd7747e3..5ecb4d6ae9 100644 --- a/core/includes/bootstrap.inc +++ b/core/includes/bootstrap.inc @@ -28,7 +28,8 @@ * Minimum recommended version of PHP. * * Sites installing Drupal on PHP versions lower than this will see a warning - * message, but Drupal can still be installed. + * message, but Drupal can still be installed. Used for (e.g.) PHP versions + * that have reached their EOL or will in the near future. */ const DRUPAL_RECOMMENDED_PHP = '7.1.7'; diff --git a/core/modules/system/system.install b/core/modules/system/system.install index c7da69b45c..f0c236ace7 100644 --- a/core/modules/system/system.install +++ b/core/modules/system/system.install @@ -157,36 +157,44 @@ function system_requirements($phase) { } } + // Verify the user is running a supported PHP version. + // If the site is running a recommended version of PHP, just display it + // as an informational message on the status report. This will be overridden + // with an error or warning if the site is running a PHP version that is no + // longer supported by Drupal, or that will drop support in the near future. $phpversion = $phpversion_label = phpversion(); - if (version_compare($phpversion, DRUPAL_MINIMUM_PHP) < 0) { - $requirements['php']['description'] = t('Your PHP installation is too old. Drupal requires at least PHP %version.', ['%version' => DRUPAL_MINIMUM_PHP]); - $requirements['php']['severity'] = REQUIREMENT_ERROR; - // If PHP is old, it's not safe to continue with the requirements check. - return $requirements; - } - elseif ((version_compare($phpversion, DRUPAL_RECOMMENDED_PHP) < 0) && ($phase === 'install' || $phase === 'runtime')) { - $requirements['php']['description'] = t('Your PHP installation is running version %version. It is recommended to upgrade to version %recommended or higher to ensure your site remains secure and continues to receive updates. See PHP\'s version support documentation and the PHP requirements handbook page for more information.', ['%version' => $phpversion, '%recommended' => DRUPAL_RECOMMENDED_PHP, ':php_requirements' => 'https://www.drupal.org/docs/8/system-requirements/php']); - $requirements['php']['severity'] = REQUIREMENT_WARNING; - } - - // Test PHP version and show link to phpinfo() if it's available if (function_exists('phpinfo')) { + // If the site is running a recommended PHP version and has the phpinfo() + // function enabled, add a link to the phpinfo() to the description of the + // PHP version. if ($phase === 'runtime') { $phpversion_label = t('@phpversion (more information)', ['@phpversion' => $phpversion, ':url' => (new Url('system.php'))->toString()]); } - $requirements['phpinfo'] = [ + $requirements['php'] = [ 'title' => t('PHP'), 'value' => $phpversion_label, ]; } else { - $requirements['phpinfo'] = [ + // @todo Revisit whethe this description makes sense in + // https://www.drupal.org/project/drupal/issues/2927318. + $requirements['php'] = [ 'title' => t('PHP'), 'value' => $phpversion_label, 'description' => t('The phpinfo() function has been disabled for security reasons. To see your server\'s phpinfo() information, change your PHP settings or contact your server administrator. For more information, Enabling and disabling phpinfo() handbook page.', [':phpinfo' => 'https://www.drupal.org/node/243993']), 'severity' => REQUIREMENT_INFO, ]; } + if (version_compare($phpversion, DRUPAL_MINIMUM_PHP) < 0) { + $requirements['php']['description'] = t('Your PHP installation is too old. Drupal requires at least PHP %version.', ['%version' => DRUPAL_MINIMUM_PHP]); + $requirements['php']['severity'] = REQUIREMENT_ERROR; + // If PHP is old, it's not safe to continue with the requirements check. + return $requirements; + } + elseif ((version_compare($phpversion, DRUPAL_RECOMMENDED_PHP) < 0) && ($phase === 'install' || $phase === 'runtime')) { + $requirements['php']['description'] = t('Your PHP installation is running version %version. It is recommended to upgrade to version %recommended or higher to ensure your site remains secure and continues to receive updates. See PHP\'s version support documentation and the PHP requirements handbook page for more information.', ['%version' => $phpversion, '%recommended' => DRUPAL_RECOMMENDED_PHP, ':php_requirements' => 'https://www.drupal.org/docs/8/system-requirements/php']); + $requirements['php']['severity'] = REQUIREMENT_WARNING; + } // Suggest to update to at least 5.5.21 or 5.6.5 for disabling multiple // statements.