From 8b57631b2cb6836c8c1fb0931e57e10cfdba6710 Mon Sep 17 00:00:00 2001
From: Bradley M. Froehle <brad.froehle@gmail.com>
Date: Tue, 16 Nov 2010 10:38:12 -0800
Subject: [PATCH] 962318: 21 - Verify PCRE_VERSION >= 7.2

---
 modules/system/system.install |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)

diff --git modules/system/system.install modules/system/system.install
index ad76e11..b26f85c 100644
--- modules/system/system.install
+++ modules/system/system.install
@@ -147,6 +147,24 @@ function system_requirements($phase) {
     $requirements['php_extensions']['value'] = $t('Enabled');
   }
 
+  if (extension_loaded('pcre')) {
+    // Test for version of PCRE.  If PCRE isn't loaded, the user would have
+    // already gotten an error. Version 7.2 or higher is required for the
+    // (?| construction used in drupal_load_stylesheet_content().
+    $minimum_pcre_version = '7.2';
+    list($pcre_version) = explode(' ', PCRE_VERSION, 2);
+    if (version_compare($pcre_version, $minimum_pcre_version) < 0) {
+      $requirements['pcre']['title'] = $t('PCRE');
+      $requirements['pcre']['severity'] = REQUIREMENT_ERROR;
+      $requirements['pcre']['value'] = PCRE_VERSION;
+      $requirements['pcre']['description'] = $t('Your <a href="@pcre_extension">PCRE extension</a> is too old. Drupal requires at least PCRE @minimum_pcre_version.  See the <a href="@system_requirements">system requirements page</a> for more information.', array(
+        '@pcre_extension' => 'http://php.net/manual/en/book.pcre.php',
+        '@minimum_pcre_version' => $minimum_pcre_version,
+        '@system_requirements' => 'http://drupal.org/requirements',
+      ));
+    }
+  }
+
   if ($phase == 'install' || $phase == 'update') {
     // Test for PDO (database).
     $requirements['database_extensions'] = array(
-- 
1.7.3.2

