Skip to content
Snippets Groups Projects
Commit ed11cb2b authored by Alex Pott's avatar Alex Pott
Browse files

Issue #2049167 by jbrown: Fixed Don't use function_exists() on functions that...

Issue #2049167 by jbrown: Fixed Don't use function_exists() on functions that are built into PHP 5.3.
parent 47ff5ffb
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -30,12 +30,9 @@ public static function randomBytes($count) {
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.
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();
}
if (!isset($random_state)) {
$random_state = print_r($_SERVER, TRUE) . getmypid();
$bytes = '';
}
if (strlen($bytes) < $count) {
......
......
......@@ -295,8 +295,7 @@ 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')) {
// Make sure enough memory is available.
// Fetch source image dimensions.
$source = drupal_get_path('theme', $theme) . '/' . $info['base_image'];
list($width, $height) = getimagesize($source);
......@@ -315,7 +314,6 @@ function color_scheme_form_submit($form, &$form_state) {
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.
$files = $config->get('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'),
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment