diff -u b/core/includes/bootstrap.inc b/core/includes/bootstrap.inc --- b/core/includes/bootstrap.inc +++ b/core/includes/bootstrap.inc @@ -18,11 +18,14 @@ use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException; /** - * Minimum supported version of PHP. - * - * Updates cannot be run on versions of PHP older than this version. + * Minimum allowed version of PHP. * - * The installer exits early on versions of PHP older than this version. + * Below this version: + * - The installer cannot be run. + * - Updates cannot be run. + * - Modules and themes cannot be enabled. + * - If a site managed to bypass all of the above, then an error is shown in + * the status report and various fatal errors occur on various pages. * * @see install.php * @@ -32,12 +35,18 @@ const DRUPAL_MINIMUM_PHP = '5.5.9'; /** - * Drupal cannot be installed on versions of PHP older than this version. + * Minimum supported version of PHP. + * + * Below this version: + * - New sites cannot be installed, except from within tests. + * - Updates from previous Drupal versions can be run, but users are warned + * that Drupal no longer supports this PHP version. + * - An error is shown in the status report that the PHP version is too old. * * @todo Move this to an appropriate autoloadable class. See * https://www.drupal.org/project/drupal/issues/2908079 */ -const DRUPAL_MINIMUM_INSTALL_PHP = '7.0.8'; +const DRUPAL_MINIMUM_SUPPORTED_PHP = '7.0.8'; /** * Minimum recommended version of PHP. diff -u b/core/modules/system/system.install b/core/modules/system/system.install --- b/core/modules/system/system.install +++ b/core/modules/system/system.install @@ -186,30 +186,40 @@ ]; } - if (version_compare($phpversion, DRUPAL_MINIMUM_INSTALL_PHP) < 0) { + // Check if the PHP version is below what Drupal supports. + if (version_compare($phpversion, DRUPAL_MINIMUM_SUPPORTED_PHP) < 0) { $requirements['php']['description'] = t('Your PHP installation is too old. Drupal requires at least PHP %version. It is recommended to upgrade to PHP version %recommended or higher for the best ongoing support. See PHP\'s version support documentation and the Drupal 8 PHP requirements handbook page for more information.', [ - '%version' => DRUPAL_MINIMUM_INSTALL_PHP, + '%version' => DRUPAL_MINIMUM_SUPPORTED_PHP, '%recommended' => DRUPAL_RECOMMENDED_PHP, ':php_requirements' => 'https://www.drupal.org/docs/8/system-requirements/php', ] ); $requirements['php']['severity'] = REQUIREMENT_ERROR; - // If PHP is old, it's not safe to continue with the requirements check. + // If the PHP version is also below the absolute minimum allowed, it's not + // safe to continue with the requirements check. if (version_compare($phpversion, DRUPAL_MINIMUM_PHP) < 0) { return $requirements; } - // Only show a warning during updates, so sites running on an older version - // of PHP are still able to run them. + // Otherwise downgrade the error to a warning during updates. Even if there + // are some problems with the site's PHP version, it's still better for the + // site to keep its Drupal codebase up to date. elseif ($phase === 'update') { $requirements['php']['severity'] = REQUIREMENT_WARNING; } - // Allow test installations of Drupal on older PHP versions. + // Since we allow sites with unsupported PHP versions to still run Drupal + // updates, we also need to be able to run tests with those PHP versions, + // which requires the ability to install test sites. Not all tests are + // required to pass on these PHP versions, but we want to monitor which + // ones do and don't. elseif ($phase === 'install' && drupal_valid_test_ua()) { $requirements['php']['severity'] = REQUIREMENT_INFO; } } + // For PHP versions that are still supported but no longer recommended, + // inform users of what's recommended, allowing them to take action before it + // becomes urgent. elseif ($phase === 'runtime' && version_compare($phpversion, DRUPAL_RECOMMENDED_PHP) < 0) { $requirements['php']['description'] = t('It is recommended to upgrade to PHP version %recommended or higher for the best ongoing support. See PHP\'s version support documentation and the Drupal 8 PHP requirements handbook page for more information.', ['%recommended' => DRUPAL_RECOMMENDED_PHP, ':php_requirements' => 'https://www.drupal.org/docs/8/system-requirements/php']); $requirements['php']['severity'] = REQUIREMENT_INFO; diff -u b/core/tests/Drupal/Tests/Core/Command/QuickStartTest.php b/core/tests/Drupal/Tests/Core/Command/QuickStartTest.php --- b/core/tests/Drupal/Tests/Core/Command/QuickStartTest.php +++ b/core/tests/Drupal/Tests/Core/Command/QuickStartTest.php @@ -84,7 +84,7 @@ * Tests the quick-start command. */ public function testQuickStartCommand() { - if (version_compare(phpversion(), DRUPAL_MINIMUM_INSTALL_PHP) < 0) { + if (version_compare(phpversion(), DRUPAL_MINIMUM_SUPPORTED_PHP) < 0) { $this->markTestSkipped(); } @@ -140,7 +140,7 @@ * Tests that the installer throws a requirement error on older PHP versions. */ public function testPhpRequirement() { - if (version_compare(phpversion(), DRUPAL_MINIMUM_INSTALL_PHP) >= 0) { + if (version_compare(phpversion(), DRUPAL_MINIMUM_SUPPORTED_PHP) >= 0) { $this->markTestSkipped(); } @@ -164,7 +164,7 @@ $error_output = $process->getErrorOutput(); $this->assertContains('Your PHP installation is too old.', $error_output); $this->assertContains('Drupal requires at least PHP', $error_output); - $this->assertContains(DRUPAL_MINIMUM_INSTALL_PHP, $error_output); + $this->assertContains(DRUPAL_MINIMUM_SUPPORTED_PHP, $error_output); // Stop the web server. $process->stop(); @@ -174,7 +174,7 @@ * Tests the quick-start commands. */ public function testQuickStartInstallAndServerCommands() { - if (version_compare(phpversion(), DRUPAL_MINIMUM_INSTALL_PHP) < 0) { + if (version_compare(phpversion(), DRUPAL_MINIMUM_SUPPORTED_PHP) < 0) { $this->markTestSkipped(); } diff -u b/core/tests/Drupal/Tests/RequirementsPageTrait.php b/core/tests/Drupal/Tests/RequirementsPageTrait.php --- b/core/tests/Drupal/Tests/RequirementsPageTrait.php +++ b/core/tests/Drupal/Tests/RequirementsPageTrait.php @@ -12,7 +12,7 @@ */ protected function updateRequirementsProblem() { // Assert a warning is shown on older test environments. - if (version_compare(phpversion(), DRUPAL_MINIMUM_INSTALL_PHP) < 0) { + if (version_compare(phpversion(), DRUPAL_MINIMUM_SUPPORTED_PHP) < 0) { $this->assertNoText('Errors found'); $this->assertWarningSummaries(['PHP']); $this->clickLink('try again');