Commit dea6d08c authored by Dries's avatar Dries

- Patch #576508 by aspilicious, jbrown, Rob Loach, TR: require PHP 5.3.

parent d5a48d21
......@@ -3,7 +3,7 @@ SQLITE REQUIREMENTS
-------------------
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
......
......@@ -15,7 +15,7 @@ REQUIREMENTS AND NOTES
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
......
......@@ -317,9 +317,7 @@ function authorize_get_filetransfer($backend, $settings = array()) {
require_once $file;
}
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.
$filetransfer = call_user_func_array(array($backend_info['class'], 'factory'), array(DRUPAL_ROOT, $settings));
$filetransfer = $backend_info['class']::factory(DRUPAL_ROOT, $settings);
}
}
return $filetransfer;
......
......@@ -16,10 +16,6 @@ public function __construct() {
'function' => 'checkEncoding',
'arguments' => array(),
);
$this->tasks[] = array(
'function' => 'checkPHPVersion',
'arguments' => array(),
);
$this->tasks[] = array(
'function' => 'checkBinaryOutput',
'arguments' => array(),
......@@ -62,23 +58,6 @@ protected function checkEncoding() {
}
}
/**
* 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.'));
};
}
/**
* Check Binary Output.
*
......
......@@ -40,12 +40,10 @@ function drupal_error_levels() {
E_USER_NOTICE => array('User notice', LOG_NOTICE),
E_STRICT => array('Strict warning', LOG_DEBUG),
E_RECOVERABLE_ERROR => array('Recoverable fatal error', LOG_ERR),
E_DEPRECATED => array('Deprecated function', LOG_DEBUG),
E_USER_DEPRECATED => array('User deprecated function', LOG_DEBUG),
);
// E_DEPRECATED and E_USER_DEPRECATED were added in PHP 5.3.0.
if (defined('E_DEPRECATED')) {
$types[E_DEPRECATED] = array('Deprecated function', LOG_DEBUG);
$types[E_USER_DEPRECATED] = array('User deprecated function', LOG_DEBUG);
}
return $types;
}
......
......@@ -2169,14 +2169,8 @@ function drupal_realpath($uri) {
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 @@ function file_directory_temp() {
$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)) {
......
......@@ -16,8 +16,11 @@
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.';
// 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.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;
}
......
......@@ -76,15 +76,6 @@ function system_requirements($phase) {
// 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(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment