summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathaniel Catchpole2017-01-16 14:29:23 (GMT)
committerNathaniel Catchpole2017-01-16 14:29:23 (GMT)
commit38092ac0a06ab297f388e2e74d617d69d86f6152 (patch)
treee3d3e3c8aa3f8c2d899dc1bedb5739792e7f1edf
parent62f81217bd24b588768e652305fd6b646b34bbf2 (diff)
Issue #2670966 by Crell, alexpott, catch, tstoeckler, cilefen, David_Rothstein, Fabianx, webchick, timmillwood, hussainweb, JeroenT, daffie: Warn users of PHP 5.5 and recommend PHP 7
-rw-r--r--core/includes/bootstrap.inc12
-rw-r--r--core/modules/system/system.install10
2 files changed, 21 insertions, 1 deletions
diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc
index f74859e..05339e5 100644
--- a/core/includes/bootstrap.inc
+++ b/core/includes/bootstrap.inc
@@ -24,6 +24,18 @@ use Drupal\Core\StringTranslation\TranslatableMarkup;
const DRUPAL_MINIMUM_PHP = '5.5.9';
/**
+ * Minimum version of PHP receiving security updates.
+ *
+ * @see https://secure.php.net/supported-versions.php
+ */
+const DRUPAL_MINIMUM_SECURE_PHP = '5.6';
+
+/**
+ * Minimum recommended version of PHP.
+ */
+const DRUPAL_RECOMMENDED_PHP = '7.0.0';
+
+/**
* Minimum recommended value of PHP memory_limit.
*
* 64M was chosen as a minimum requirement in order to allow for additional
diff --git a/core/modules/system/system.install b/core/modules/system/system.install
index f1fcfba..928062e 100644
--- a/core/modules/system/system.install
+++ b/core/modules/system/system.install
@@ -177,11 +177,19 @@ function system_requirements($phase) {
// If PHP is old, it's not safe to continue with the requirements check.
return $requirements;
}
+ elseif (version_compare($phpversion, DRUPAL_MINIMUM_SECURE_PHP) < 0) {
+ $requirements['php']['description'] = t('Your PHP installation is running version %version, which is no longer receiving security support from the PHP development team. We recommend upgrading to version %recommended or higher.', ['%version' => $phpversion, '%recommended' => DRUPAL_RECOMMENDED_PHP]);
+ $requirements['php']['severity'] = REQUIREMENT_WARNING;
+ }
+ elseif (version_compare($phpversion, DRUPAL_RECOMMENDED_PHP) < 0) {
+ $requirements['php']['description'] = t('Your PHP installation is running version %version. We recommend upgrading to version %recommended or higher.', ['%version' => $phpversion, '%recommended' => DRUPAL_RECOMMENDED_PHP]);
+ $requirements['php']['severity'] = REQUIREMENT_INFO;
+ }
// Suggest to update to at least 5.5.21 or 5.6.5 for disabling multiple
// statements.
if (($phase === 'install' || \Drupal::database()->driver() === 'mysql') && !SystemRequirements::phpVersionWithPdoDisallowMultipleStatements($phpversion)) {
- $requirements['php'] = array(
+ $requirements['php_mysql'] = array(
'title' => t('PHP (multiple statement disabling)'),
'value' => $phpversion_label,
'description' => t('PHP versions higher than 5.6.5 or 5.5.21 provide built-in SQL injection protection for mysql databases. It is recommended to update.'),