From df20c166d9ce71eaaca925c17db4768178647918 Mon Sep 17 00:00:00 2001
From: catch <catch@35733.no-reply.drupal.org>
Date: Tue, 7 Oct 2014 23:14:37 +0100
Subject: [PATCH] Issue #2267551 by jfhovinne, ParisLiakos, catch: PHP 5.4.5
 needed to avoid zend failure when using autoloaded traits.

---
 composer.json                      | 2 +-
 core/INSTALL.txt                   | 3 ++-
 core/includes/bootstrap.inc        | 9 ++++++++-
 core/install.php                   | 4 ++--
 core/modules/system/system.install | 2 +-
 core/scripts/password-hash.sh      | 4 ++--
 6 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/composer.json b/composer.json
index 51d466404c31..37164c577877 100644
--- a/composer.json
+++ b/composer.json
@@ -4,7 +4,7 @@
   "type": "drupal-core",
   "license": "GPL-2.0+",
   "require": {
-    "php": ">=5.4.2",
+    "php": ">5.4.4-13",
     "sdboyer/gliph": "0.1.*",
     "symfony/class-loader": "2.5.*",
     "symfony/css-selector": "2.5.*",
diff --git a/core/INSTALL.txt b/core/INSTALL.txt
index f985620ab1fa..860945861744 100644
--- a/core/INSTALL.txt
+++ b/core/INSTALL.txt
@@ -19,7 +19,8 @@ Drupal requires:
 - A web server with PHP support, for example:
   - Apache 2.0 (or greater) (http://httpd.apache.org/).
   - Nginx 1.1 (or greater) (http://www.nginx.com/).
-- PHP 5.4.2 (or greater) (http://www.php.net/).
+- PHP 5.4.5 (or greater) (http://www.php.net/) or the version that ships with
+  Debian Wheezy (5.4.4-14) (https://www.debian.org/releases/wheezy/).
 - One of the following databases:
   - MySQL 5.0.15 (or greater) (http://www.mysql.com/).
   - MariaDB 5.1.44 (or greater) (http://mariadb.org/). MariaDB is a fully
diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc
index 6b199ec6c65f..78c4a3217d1b 100644
--- a/core/includes/bootstrap.inc
+++ b/core/includes/bootstrap.inc
@@ -22,7 +22,14 @@
 /**
  * Minimum supported version of PHP.
  */
-const DRUPAL_MINIMUM_PHP = '5.4.2';
+const DRUPAL_MINIMUM_PHP = '5.4.5';
+
+/**
+ * Minimum supported version of PHP on Debian.
+ *
+ * @see https://www.drupal.org/node/2267551.
+ */
+const DRUPAL_MINIMUM_PHP_DEBIAN = '5.4.4-14+deb7u14';
 
 /**
  * Minimum recommended value of PHP memory_limit.
diff --git a/core/install.php b/core/install.php
index 156ff917a16d..4fdda9ae8c99 100644
--- a/core/install.php
+++ b/core/install.php
@@ -21,8 +21,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.4.2') < 0) {
-  print 'Your PHP installation is too old. Drupal requires at least PHP 5.4.2. See the <a href="http://drupal.org/requirements">system requirements</a> page for more information.';
+if (version_compare(PHP_VERSION, '5.4.4-14+deb7u14') < 0 && version_compare(PHP_VERSION, '5.4.5') < 0) {
+  print 'Your PHP installation is too old. Drupal requires at least PHP 5.4.5. See the <a href="http://drupal.org/requirements">system requirements</a> page for more information.';
   exit;
 }
 
diff --git a/core/modules/system/system.install b/core/modules/system/system.install
index 868b2eba1195..c1751c483490 100644
--- a/core/modules/system/system.install
+++ b/core/modules/system/system.install
@@ -72,7 +72,7 @@ function system_requirements($phase) {
     );
   }
 
-  if (version_compare($phpversion, DRUPAL_MINIMUM_PHP) < 0) {
+  if (version_compare($phpversion, DRUPAL_MINIMUM_PHP_DEBIAN) < 0 && version_compare($phpversion, DRUPAL_MINIMUM_PHP) < 0) {
     $requirements['php']['description'] = t('Your PHP installation is too old. Drupal requires at least PHP %version.', array('%version' => DRUPAL_MINIMUM_PHP));
     $requirements['php']['severity'] = REQUIREMENT_ERROR;
     // If PHP is old, it's not safe to continue with the requirements check.
diff --git a/core/scripts/password-hash.sh b/core/scripts/password-hash.sh
index 38bc72607b70..fd55c6b8baca 100755
--- a/core/scripts/password-hash.sh
+++ b/core/scripts/password-hash.sh
@@ -15,11 +15,11 @@
   return;
 }
 
-if (version_compare(PHP_VERSION, "5.4.2", "<")) {
+if (version_compare(PHP_VERSION, '5.4.4-14+deb7u14') < 0 && version_compare(PHP_VERSION, '5.4.5') < 0) {
   $version  = PHP_VERSION;
   echo <<<EOF
 
-ERROR: This script requires at least PHP version 5.4.2. You invoked it with
+ERROR: This script requires at least PHP version 5.4.5. You invoked it with
        PHP version {$version}.
 \n
 EOF;
-- 
GitLab