Issue #2049167 by jbrown: Fixed Don't use function_exists() on functions that are built into PHP 5.3.
parent
47ff5ffbb8
commit
ed11cb2b39
|
|
@ -30,12 +30,9 @@ class Crypt {
|
|||
static $random_state, $bytes;
|
||||
// Initialize on the first call. The contents of $_SERVER includes a mix of
|
||||
// user-specific and system information that varies a little with each page.
|
||||
// Further initialize with the somewhat random PHP process ID.
|
||||
if (!isset($random_state)) {
|
||||
$random_state = print_r($_SERVER, TRUE);
|
||||
if (function_exists('getmypid')) {
|
||||
// Further initialize with the somewhat random PHP process ID.
|
||||
$random_state .= getmypid();
|
||||
}
|
||||
$random_state = print_r($_SERVER, TRUE) . getmypid();
|
||||
$bytes = '';
|
||||
}
|
||||
if (strlen($bytes) < $count) {
|
||||
|
|
|
|||
|
|
@ -295,26 +295,24 @@ function color_scheme_form_submit($form, &$form_state) {
|
|||
$palette += $info['schemes']['default']['colors'];
|
||||
}
|
||||
|
||||
// Make sure enough memory is available, if PHP's memory limit is compiled in.
|
||||
if (function_exists('memory_get_usage')) {
|
||||
// Fetch source image dimensions.
|
||||
$source = drupal_get_path('theme', $theme) . '/' . $info['base_image'];
|
||||
list($width, $height) = getimagesize($source);
|
||||
// Make sure enough memory is available.
|
||||
// Fetch source image dimensions.
|
||||
$source = drupal_get_path('theme', $theme) . '/' . $info['base_image'];
|
||||
list($width, $height) = getimagesize($source);
|
||||
|
||||
// We need at least a copy of the source and a target buffer of the same
|
||||
// size (both at 32bpp).
|
||||
$required = $width * $height * 8;
|
||||
// We intend to prevent color scheme changes if there isn't enough memory
|
||||
// available. memory_get_usage(TRUE) returns a more accurate number than
|
||||
// memory_get_usage(), therefore we won't inadvertently reject a color
|
||||
// scheme change based on a faulty memory calculation.
|
||||
$usage = memory_get_usage(TRUE);
|
||||
$memory_limit = ini_get('memory_limit');
|
||||
$size = parse_size($memory_limit);
|
||||
if (!drupal_check_memory_limit($usage + $required, $memory_limit)) {
|
||||
drupal_set_message(t('There is not enough memory available to PHP to change this theme\'s color scheme. You need at least %size more. Check the <a href="@url">PHP documentation</a> for more information.', array('%size' => format_size($usage + $required - $size), '@url' => 'http://www.php.net/manual/ini.core.php#ini.sect.resource-limits')), 'error');
|
||||
return;
|
||||
}
|
||||
// We need at least a copy of the source and a target buffer of the same
|
||||
// size (both at 32bpp).
|
||||
$required = $width * $height * 8;
|
||||
// We intend to prevent color scheme changes if there isn't enough memory
|
||||
// available. memory_get_usage(TRUE) returns a more accurate number than
|
||||
// memory_get_usage(), therefore we won't inadvertently reject a color
|
||||
// scheme change based on a faulty memory calculation.
|
||||
$usage = memory_get_usage(TRUE);
|
||||
$memory_limit = ini_get('memory_limit');
|
||||
$size = parse_size($memory_limit);
|
||||
if (!drupal_check_memory_limit($usage + $required, $memory_limit)) {
|
||||
drupal_set_message(t('There is not enough memory available to PHP to change this theme\'s color scheme. You need at least %size more. Check the <a href="@url">PHP documentation</a> for more information.', array('%size' => format_size($usage + $required - $size), '@url' => 'http://www.php.net/manual/ini.core.php#ini.sect.resource-limits')), 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
// Delete old files.
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ function simpletest_requirements($phase) {
|
|||
$requirements = array();
|
||||
|
||||
$has_curl = function_exists('curl_init');
|
||||
$has_hash = function_exists('hash_hmac');
|
||||
$has_domdocument = method_exists('DOMDocument', 'loadHTML');
|
||||
$open_basedir = ini_get('open_basedir');
|
||||
|
||||
|
|
@ -29,14 +28,6 @@ function simpletest_requirements($phase) {
|
|||
$requirements['curl']['severity'] = REQUIREMENT_ERROR;
|
||||
$requirements['curl']['description'] = t('The testing framework could not be installed because the PHP <a href="@curl_url">cURL</a> library is not available.', array('@curl_url' => 'http://php.net/manual/curl.setup.php'));
|
||||
}
|
||||
$requirements['hash'] = array(
|
||||
'title' => t('hash'),
|
||||
'value' => $has_hash ? t('Enabled') : t('Not found'),
|
||||
);
|
||||
if (!$has_hash) {
|
||||
$requirements['hash']['severity'] = REQUIREMENT_ERROR;
|
||||
$requirements['hash']['description'] = t('The testing framework could not be installed because the PHP <a href="@hash_url">hash</a> extension is disabled.', array('@hash_url' => 'http://php.net/manual/book.hash.php'));
|
||||
}
|
||||
|
||||
$requirements['php_domdocument'] = array(
|
||||
'title' => t('PHP DOMDocument class'),
|
||||
|
|
|
|||
Loading…
Reference in New Issue