diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc index 499f552..5dee0a0 100644 --- a/core/includes/bootstrap.inc +++ b/core/includes/bootstrap.inc @@ -25,7 +25,15 @@ * @todo Move this to an appropriate autoloadable class. See * https://www.drupal.org/project/drupal/issues/2908079 */ -const DRUPAL_MINIMUM_PHP = '5.5.9'; +const DRUPAL_MINIMUM_PHP = '7.0.0'; + +/** + * Updates cannot be run on versions of PHP older than this version. + * + * @todo Move this to an appropriate autoloadable class. See + * https://www.drupal.org/project/drupal/issues/2908079 + */ +const DRUPAL_MINIMUM_UPDATE_PHP = '5.5.9'; /** * Minimum recommended version of PHP. diff --git a/core/includes/install.inc b/core/includes/install.inc index 70c82b4..13f0372 100644 --- a/core/includes/install.inc +++ b/core/includes/install.inc @@ -1116,7 +1116,7 @@ function install_profile_info($profile, $langcode = 'en') { 'description' => '', 'version' => NULL, 'hidden' => FALSE, - 'php' => DRUPAL_MINIMUM_PHP, + 'php' => DRUPAL_MINIMUM_UPDATE_PHP, 'config_install_path' => NULL, ]; $profile_path = drupal_get_path('profile', $profile); diff --git a/core/install.php b/core/install.php index c88ffee..d367bce 100644 --- a/core/install.php +++ b/core/install.php @@ -25,8 +25,8 @@ // The minimum version is specified explicitly, as DRUPAL_MINIMUM_PHP is not // yet available. It is defined in bootstrap.inc, but it is not possible to // load that file yet as it would cause a fatal error on older versions of PHP. -if (version_compare(PHP_VERSION, '5.5.9') < 0) { - print 'Your PHP installation is too old. Drupal requires at least PHP 5.5.9. See the system requirements page for more information.'; +if (version_compare(PHP_VERSION, '7.0.0') < 0) { + print 'Your PHP installation is too old. Drupal requires at least PHP 7.0.0. See the system requirements page for more information.'; exit; } diff --git a/core/lib/Drupal/Core/Extension/ModuleExtensionList.php b/core/lib/Drupal/Core/Extension/ModuleExtensionList.php index c8f492b..07a1d83 100644 --- a/core/lib/Drupal/Core/Extension/ModuleExtensionList.php +++ b/core/lib/Drupal/Core/Extension/ModuleExtensionList.php @@ -28,7 +28,7 @@ class ModuleExtensionList extends ExtensionList { 'description' => '', 'package' => 'Other', 'version' => NULL, - 'php' => DRUPAL_MINIMUM_PHP, + 'php' => DRUPAL_MINIMUM_UPDATE_PHP, ]; /** diff --git a/core/lib/Drupal/Core/Extension/ProfileExtensionList.php b/core/lib/Drupal/Core/Extension/ProfileExtensionList.php index 7c41516..bb054d0 100644 --- a/core/lib/Drupal/Core/Extension/ProfileExtensionList.php +++ b/core/lib/Drupal/Core/Extension/ProfileExtensionList.php @@ -22,7 +22,7 @@ class ProfileExtensionList extends ExtensionList { 'description' => '', 'package' => 'Other', 'version' => NULL, - 'php' => DRUPAL_MINIMUM_PHP, + 'php' => DRUPAL_MINIMUM_UPDATE_PHP, ]; /** diff --git a/core/lib/Drupal/Core/Extension/ThemeEngineExtensionList.php b/core/lib/Drupal/Core/Extension/ThemeEngineExtensionList.php index c4d39ef..aef0d4e 100644 --- a/core/lib/Drupal/Core/Extension/ThemeEngineExtensionList.php +++ b/core/lib/Drupal/Core/Extension/ThemeEngineExtensionList.php @@ -21,7 +21,7 @@ class ThemeEngineExtensionList extends ExtensionList { 'description' => '', 'package' => 'Other', 'version' => NULL, - 'php' => DRUPAL_MINIMUM_PHP, + 'php' => DRUPAL_MINIMUM_UPDATE_PHP, ]; /** diff --git a/core/lib/Drupal/Core/Extension/ThemeExtensionList.php b/core/lib/Drupal/Core/Extension/ThemeExtensionList.php index 07a2f3f..5468c3f 100644 --- a/core/lib/Drupal/Core/Extension/ThemeExtensionList.php +++ b/core/lib/Drupal/Core/Extension/ThemeExtensionList.php @@ -48,7 +48,7 @@ class ThemeExtensionList extends ExtensionList { 'comment_user_verification', ], 'screenshot' => 'screenshot.png', - 'php' => DRUPAL_MINIMUM_PHP, + 'php' => DRUPAL_MINIMUM_UPDATE_PHP, 'libraries' => [], 'libraries_extend' => [], 'libraries_override' => [], diff --git a/core/modules/system/system.install b/core/modules/system/system.install index 960bb7d..1deb173 100644 --- a/core/modules/system/system.install +++ b/core/modules/system/system.install @@ -188,22 +188,14 @@ function system_requirements($phase) { 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; + $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; } - if ((version_compare($phpversion, DRUPAL_RECOMMENDED_PHP) < 0) && ($phase === 'install' || $phase === 'runtime')) { - // Warn if still on PHP 5. If at least PHP 7.0, relax from "warning" to - // "info", and show it at runtime only, to not scare users while installing. - if (version_compare($phpversion, '7.0') < 0) { - $requirements['php']['description'] = t('Drupal will drop support for this version on March 6, 2019. Upgrade to PHP version %recommended or higher to ensure your site can receive updates and remain secure. 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_WARNING; - } - else { - if ($phase === 'runtime') { - $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; - } + if (version_compare($phpversion, DRUPAL_RECOMMENDED_PHP) < 0) { + if ($phase === 'runtime') { + $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 --git a/core/tests/Drupal/Tests/BrowserTestBase.php b/core/tests/Drupal/Tests/BrowserTestBase.php index 73a2fd4..7dc0199 100644 --- a/core/tests/Drupal/Tests/BrowserTestBase.php +++ b/core/tests/Drupal/Tests/BrowserTestBase.php @@ -9,6 +9,7 @@ use Behat\Mink\Session; use Drupal\Component\Serialization\Json; use Drupal\Core\Database\Database; +use Drupal\Core\Installer\Exception\InstallerException; use Drupal\Core\Test\FunctionalTestSetupTrait; use Drupal\Core\Test\TestSetupTrait; use Drupal\Core\Utility\Error; @@ -395,7 +396,18 @@ protected function setUp() { // Install Drupal test site. $this->prepareEnvironment(); - $this->installDrupal(); + + try { + $this->installDrupal(); + } + catch (InstallerException $e) { + // Rethrow if it's not a PHP version error. + if (version_compare(phpversion(), DRUPAL_MINIMUM_PHP) >= 0) { + throw $e; + } + + $this->markTestSkipped($e->getMessage()); + } // Setup Mink. $this->initMink(); diff --git a/core/tests/Drupal/Tests/Core/Extension/ThemeExtensionListTest.php b/core/tests/Drupal/Tests/Core/Extension/ThemeExtensionListTest.php index 9c5fd58..cba97b8 100644 --- a/core/tests/Drupal/Tests/Core/Extension/ThemeExtensionListTest.php +++ b/core/tests/Drupal/Tests/Core/Extension/ThemeExtensionListTest.php @@ -259,6 +259,6 @@ class TestThemeEngineExtensionList extends ThemeEngineExtensionList { } -if (!defined('DRUPAL_MINIMUM_PHP')) { - define('DRUPAL_MINIMUM_PHP', '5.5.9'); +if (!defined('DRUPAL_MINIMUM_UPDATE_PHP')) { + define('DRUPAL_MINIMUM_UPDATE_PHP', '5.5.9'); } diff --git a/core/tests/Drupal/Tests/Core/Extension/ThemeHandlerTest.php b/core/tests/Drupal/Tests/Core/Extension/ThemeHandlerTest.php index 97a5e93..841073b 100644 --- a/core/tests/Drupal/Tests/Core/Extension/ThemeHandlerTest.php +++ b/core/tests/Drupal/Tests/Core/Extension/ThemeHandlerTest.php @@ -146,6 +146,6 @@ protected function themeRegistryRebuild() { } -if (!defined('DRUPAL_MINIMUM_PHP')) { - define('DRUPAL_MINIMUM_PHP', '5.5.9'); +if (!defined('DRUPAL_MINIMUM_UPDATE_PHP')) { + define('DRUPAL_MINIMUM_UPDATE_PHP', '5.5.9'); }