From 9a44417c8d79e4f44d4226f8834a20466b156766 Mon, 6 Jun 2011 14:29:15 +0200
From: Bram Goffings <bramgoffings@gmail.com>
Date: Mon, 6 Jun 2011 14:29:01 +0200
Subject: [PATCH] php 5.2 tot php 5.3.2


diff --git a/INSTALL.sqlite.txt b/INSTALL.sqlite.txt
index 8e57d60..b4bfcef 100644
--- a/INSTALL.sqlite.txt
+++ b/INSTALL.sqlite.txt
@@ -3,7 +3,7 @@
 -------------------
 
 To use SQLite with your Drupal installation, the following requirements must be
-met: Server has PHP 5.2 or later with PDO, and the PDO SQLite driver must be
+met: Server has PHP 5.3.2 or later with PDO, and the PDO SQLite driver must be
 enabled.
 
 SQLITE DATABASE CREATION
diff --git a/INSTALL.txt b/INSTALL.txt
index 7b526e3..8df8075 100644
--- a/INSTALL.txt
+++ b/INSTALL.txt
@@ -15,7 +15,7 @@
 Drupal requires:
 
 - A web server. Apache (version 2.0 or greater) is recommended.
-- PHP 5.2.4 (or greater) (http://www.php.net/).
+- PHP 5.3.2 (or greater) (http://www.php.net/).
 - 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/includes/authorize.inc b/includes/authorize.inc
index 3617d7d..2729d90 100644
--- a/includes/authorize.inc
+++ b/includes/authorize.inc
@@ -319,6 +319,7 @@
     if (class_exists($backend_info['class'])) {
       // PHP 5.2 doesn't support $class::factory() syntax, so we have to
       // use call_user_func_array() until we can require PHP 5.3.
+      // TODO
       $filetransfer = call_user_func_array(array($backend_info['class'], 'factory'), array(DRUPAL_ROOT, $settings));
     }
   }
diff --git a/includes/bootstrap.inc b/includes/bootstrap.inc
index 984739e..17c8e83 100644
--- a/includes/bootstrap.inc
+++ b/includes/bootstrap.inc
@@ -18,7 +18,7 @@
 /**
  * Minimum supported version of PHP.
  */
-define('DRUPAL_MINIMUM_PHP', '5.2.4');
+define('DRUPAL_MINIMUM_PHP', '5.3.2');
 
 /**
  * Minimum recommended value of PHP memory_limit.
diff --git a/includes/database/pgsql/install.inc b/includes/database/pgsql/install.inc
index c77f4ea..c350634 100644
--- a/includes/database/pgsql/install.inc
+++ b/includes/database/pgsql/install.inc
@@ -17,10 +17,6 @@
       'arguments' => array(),
     );
     $this->tasks[] = array(
-      'function' => 'checkPHPVersion',
-      'arguments' => array(),
-    );
-    $this->tasks[] = array(
       'function' => 'checkBinaryOutput',
       'arguments' => array(),
     );
@@ -60,23 +56,6 @@
     catch (Exception $e) {
       $this->fail(st('Drupal could not determine the encoding of the database was set to UTF-8'));
     }
-  }
-
-  /**
-   * Check PHP version.
-   *
-   * There are two bugs in PDO_pgsql affecting Drupal:
-   *
-   * - in versions < 5.2.7, PDO_pgsql refuses to insert an empty string into
-   *   a NOT NULL BLOB column. See: http://bugs.php.net/bug.php?id=46249
-   * - in versions < 5.2.11 and < 5.3.1 that prevents inserting integer values
-   *   into numeric columns that exceed the PHP_INT_MAX value.
-   *   See: http://bugs.php.net/bug.php?id=48924
-   */
-  function checkPHPVersion() {
-    if (!version_compare(PHP_VERSION, '5.2.11', '>=') || (version_compare(PHP_VERSION, '5.3.0', '>=') && !version_compare(PHP_VERSION, '5.3.1', '>='))) {
-      $this->fail(st('The version of PHP you are using has known issues with PostgreSQL. You need to upgrade PHP to 5.2.11, 5.3.1 or greater.'));
-    };
   }
 
   /**
diff --git a/includes/file.inc b/includes/file.inc
index b7a1204..4750ff4 100644
--- a/includes/file.inc
+++ b/includes/file.inc
@@ -2169,14 +2169,8 @@
   if ($wrapper = file_stream_wrapper_get_instance_by_uri($uri)) {
     return $wrapper->realpath();
   }
-  // Check that the uri has a value. There is a bug in PHP 5.2 on *BSD systems
-  // that makes realpath not return FALSE as expected when passing an empty
-  // variable.
-  // @todo Remove when Drupal drops support for PHP 5.2.
-  elseif (!empty($uri)) {
-    return realpath($uri);
-  }
-  return FALSE;
+
+  return realpath($uri);
 }
 
 /**
@@ -2342,11 +2336,7 @@
       $path_delimiter = '/';
     }
     // PHP may be able to find an alternative tmp directory.
-    // This function exists in PHP 5 >= 5.2.1, but Drupal
-    // requires PHP 5 >= 5.2.0, so we check for it.
-    if (function_exists('sys_get_temp_dir')) {
-      $directories[] = sys_get_temp_dir();
-    }
+    $directories[] = sys_get_temp_dir();
 
     foreach ($directories as $directory) {
       if (is_dir($directory) && is_writable($directory)) {
diff --git a/install.php b/install.php
index 881ca5a..57dea85 100644
--- a/install.php
+++ b/install.php
@@ -16,8 +16,8 @@
 define('MAINTENANCE_MODE', 'install');
 
 // Exit early if running an incompatible PHP version to avoid fatal errors.
-if (version_compare(PHP_VERSION, '5.2.4') < 0) {
-  print 'Your PHP installation is too old. Drupal requires at least PHP 5.2.4. See the <a href="http://drupal.org/requirements">system requirements</a> page for more information.';
+if (version_compare(PHP_VERSION, '5.3.2') < 0) {
+  print 'Your PHP installation is too old. Drupal requires at least PHP 5.3.2. See the <a href="http://drupal.org/requirements">system requirements</a> page for more information.';
   exit;
 }
 
diff --git a/modules/system/system.install b/modules/system/system.install
index 6d2fc80..6d80c43 100644
--- a/modules/system/system.install
+++ b/modules/system/system.install
@@ -76,15 +76,6 @@
     // If PHP is old, it's not safe to continue with the requirements check.
     return $requirements;
   }
-  // Check that htmlspecialchars() is secure if the site is running any PHP
-  // version older than 5.2.5. We don't simply require 5.2.5, because Ubuntu
-  // 8.04 ships with PHP 5.2.4, but includes the necessary security patch.
-  elseif (version_compare($phpversion, '5.2.5') < 0 && strlen(@htmlspecialchars(chr(0xC0) . chr(0xAF), ENT_QUOTES, 'UTF-8'))) {
-    $requirements['php']['description'] = $t('Your PHP installation is too old. Drupal requires at least PHP 5.2.5, or PHP @version with the htmlspecialchars security patch backported.', array('@version' => DRUPAL_MINIMUM_PHP));
-    $requirements['php']['severity'] = REQUIREMENT_ERROR;
-    // If PHP is old, it's not safe to continue with the requirements check.
-    return $requirements;
-  }
 
   // Test PHP register_globals setting.
   $requirements['php_register_globals'] = array(
