diff --git a/core/modules/system/system.install b/core/modules/system/system.install index 2031483..25f03bc 100644 --- a/core/modules/system/system.install +++ b/core/modules/system/system.install @@ -186,17 +186,22 @@ function system_requirements($phase) { ]; } - // @todo Remove once update support is dropped. - if (drupal_valid_test_ua() || getenv('DRUPAL_DEV_SITE_PATH')) { - if (version_compare($phpversion, DRUPAL_MINIMUM_UPDATE_PHP) < 0) { - $requirements['php']['description'] = t('Your PHP installation is too old. Drupal requires at least PHP %version.', ['%version' => DRUPAL_MINIMUM_UPDATE_PHP]); + if (version_compare($phpversion, DRUPAL_MINIMUM_UPDATE_PHP) < 0) { + $requirements['php']['description'] = t('Your PHP installation is too old. Drupal requires at least PHP %version.', ['%version' => DRUPAL_MINIMUM_UPDATE_PHP]); + $requirements['php']['severity'] = REQUIREMENT_ERROR; + return $requirements; + } + if (version_compare($phpversion, DRUPAL_MINIMUM_PHP) < 0) { + // Allow test installations of Drupal on the minimum update PHP. + $is_test_site = drupal_valid_test_ua() || getenv('DRUPAL_DEV_SITE_PATH'); + if ($phase === 'update') { + $requirements['php']['description'] = t('Your PHP installation is too old. Drupal requires at least PHP %version.', ['%version' => DRUPAL_MINIMUM_PHP]); + $requirements['php']['severity'] = REQUIREMENT_WARNING; + } + elseif (!$is_test_site) { + $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; - return $requirements; } - } - elseif (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'] = ($phase === 'update') ? REQUIREMENT_WARNING : REQUIREMENT_ERROR; // If PHP is old, it's not safe to continue with the requirements check. return $requirements; } diff --git a/core/modules/system/tests/src/Functional/Update/SystemRequirementsTest.php b/core/modules/system/tests/src/Functional/Update/SystemRequirementsTest.php new file mode 100644 index 0000000..c9ad3b6 --- /dev/null +++ b/core/modules/system/tests/src/Functional/Update/SystemRequirementsTest.php @@ -0,0 +1,42 @@ +drupalCreateUser(['administer software updates']); + $this->drupalLogin($user); + $url = Url::fromRoute('system.db_update'); + $this->drupalGet($url); + $warning = sprintf('Your PHP installation is too old. Drupal requires at least PHP %s.', DRUPAL_MINIMUM_PHP); + + if (version_compare(phpversion(), DRUPAL_MINIMUM_PHP) < 0) { + $this->assertText('Warnings found'); + $this->assertText($warning); + } + else { + $this->assertNoText('Warnings found'); + $this->assertNoText($warning); + } + } + +}