Commit 4b87ae18 authored by Gábor Hojtsy's avatar Gábor Hojtsy

#360605 by Berdir et al.: make Drupal core work with PHP 5.3.0 out of the box...

#360605 by Berdir et al.: make Drupal core work with PHP 5.3.0 out of the box (fixes for incompatibilities introduced with PHP 5.3.0)
parent 4fcee80f
......@@ -24,6 +24,13 @@
*/
define('SAVED_DELETED', 3);
/**
* Create E_DEPRECATED constant for older PHP versions (<5.3).
*/
if (!defined('E_DEPRECATED')) {
define('E_DEPRECATED', 8192);
}
/**
* Set content for a specified region.
*
......@@ -610,7 +617,7 @@ function drupal_error_handler($errno, $message, $filename, $line, $context) {
return;
}
if ($errno & (E_ALL)) {
if ($errno & (E_ALL ^ E_DEPRECATED)) {
$types = array(1 => 'error', 2 => 'warning', 4 => 'parse error', 8 => 'notice', 16 => 'core error', 32 => 'core warning', 64 => 'compile error', 128 => 'compile warning', 256 => 'user error', 512 => 'user warning', 1024 => 'user notice', 2048 => 'strict warning', 4096 => 'recoverable fatal error');
// For database errors, we want the line number/file name of the place that
......
......@@ -550,6 +550,8 @@ function file_save_upload($source, $validators = array(), $dest = FALSE, $replac
$errors = array();
foreach ($validators as $function => $args) {
array_unshift($args, $file);
// Make sure $file is passed around by reference.
$args[0] = &$file;
$errors = array_merge($errors, call_user_func_array($function, $args));
}
......
......@@ -293,6 +293,10 @@ function form_get_cache($form_build_id, &$form_state) {
*/
function drupal_execute($form_id, &$form_state) {
$args = func_get_args();
// Make sure $form_state is passed around by reference.
$args[1] = &$form_state;
$form = call_user_func_array('drupal_retrieve_form', $args);
$form['#post'] = $form_state['values'];
drupal_prepare_form($form_id, $form, $form_state);
......
......@@ -1978,7 +1978,7 @@ function theme_system_admin_by_module($menu_items) {
* An array of requirements.
* @ingroup themeable
*/
function theme_status_report(&$requirements) {
function theme_status_report($requirements) {
$i = 0;
$output = '<table class="system-status-report">';
foreach ($requirements as $requirement) {
......
......@@ -513,7 +513,7 @@ function _upload_form($node) {
*
* @ingroup themeable
*/
function theme_upload_form_current(&$form) {
function theme_upload_form_current($form) {
$header = array('', t('Delete'), t('List'), t('Description'), t('Weight'), t('Size'));
drupal_add_tabledrag('upload-attachments', 'order', 'sibling', 'upload-weight');
......
......@@ -1605,7 +1605,7 @@ function user_delete($edit, $uid) {
db_query('DELETE FROM {authmap} WHERE uid = %d', $uid);
$variables = array('%name' => $account->name, '%email' => '<'. $account->mail .'>');
watchdog('user', 'Deleted user: %name %email.', $variables, WATCHDOG_NOTICE);
module_invoke_all('user', 'delete', $edit, $account);
user_module_invoke('delete', $edit, $account);
}
/**
......@@ -1929,8 +1929,12 @@ function user_help($path, $arg) {
function _user_categories($account) {
$categories = array();
// Only variables can be passed by reference workaround.
$null = NULL;
foreach (module_list() as $module) {
if ($data = module_invoke($module, 'user', 'categories', NULL, $account, '')) {
$function = $module .'_user';
// $null and $account need to be passed by reference.
if (function_exists($function) && ($data = $function('categories', $null, $account, ''))) {
$categories = array_merge($data, $categories);
}
}
......@@ -2472,7 +2476,9 @@ function user_register_validate($form, &$form_state) {
function _user_forms(&$edit, $account, $category, $hook = 'form') {
$groups = array();
foreach (module_list() as $module) {
if ($data = module_invoke($module, 'user', $hook, $edit, $account, $category)) {
$function = $module .'_user';
// $edit and $account need to be passed by reference.
if (function_exists($function) && ($data = $function($hook, $edit, $account, $category))) {
$groups = array_merge_recursive($data, $groups);
}
}
......
......@@ -148,7 +148,9 @@ function user_logout() {
// Destroy the current session:
session_destroy();
module_invoke_all('user', 'logout', NULL, $user);
// Only variables can be passed by reference workaround.
$null = NULL;
user_module_invoke('logout', $null, $user);
// Load the anonymous user
$user = drupal_anonymous_user();
......
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