? .cvsignore ? drupal.php53_compat_1-D6.patch ? drupal.php53_compat_2-D6.patch ? drupal.php53_compat_3-D6.patch ? nbproject ? resources ? scripts/run-tests.sh ? sites/d6p ? sites/all/modules ? sites/default/files ? sites/default/settings.php Index: includes/common.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/common.inc,v retrieving revision 1.756.2.48 diff -u -p -r1.756.2.48 common.inc --- includes/common.inc 25 Feb 2009 23:16:45 -0000 1.756.2.48 +++ includes/common.inc 7 Apr 2009 20:17:20 -0000 @@ -25,6 +25,13 @@ define('SAVED_UPDATED', 2); 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. * * @param $region @@ -577,7 +584,7 @@ function drupal_error_handler($errno, $m 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 Index: includes/file.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/file.inc,v retrieving revision 1.121.2.5 diff -u -p -r1.121.2.5 file.inc --- includes/file.inc 20 Oct 2008 09:42:31 -0000 1.121.2.5 +++ includes/file.inc 7 Apr 2009 20:17:31 -0000 @@ -623,7 +623,7 @@ function file_validate_extensions($file, // Bypass validation for uid = 1. if ($user->uid != 1) { - $regex = '/\.('. ereg_replace(' +', '|', preg_quote($extensions)) .')$/i'; + $regex = '/\.('. str_replace(' +', '|', preg_quote($extensions)) .')$/i'; if (!preg_match($regex, $file->filename)) { $errors[] = t('Only files with the following extensions are allowed: %files-allowed.', array('%files-allowed' => $extensions)); } Index: includes/form.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/form.inc,v retrieving revision 1.265.2.19 diff -u -p -r1.265.2.19 form.inc --- includes/form.inc 22 Feb 2009 18:12:46 -0000 1.265.2.19 +++ includes/form.inc 7 Apr 2009 20:17:33 -0000 @@ -292,6 +292,10 @@ function form_get_cache($form_build_id, */ 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); Index: includes/unicode.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/unicode.inc,v retrieving revision 1.29 diff -u -p -r1.29 unicode.inc --- includes/unicode.inc 28 Dec 2007 12:02:50 -0000 1.29 +++ includes/unicode.inc 7 Apr 2009 20:17:55 -0000 @@ -135,7 +135,7 @@ function drupal_xml_parser_create(&$data } // Check for an encoding declaration in the XML prolog if no BOM was found. - if (!$bom && ereg('^<\?xml[^>]+encoding="([^"]+)"', $data, $match)) { + if (!$bom && preg_match('/^<\?xml[^>]+encoding="(.+?)"/', $data, $match)) { $encoding = $match[1]; } @@ -145,7 +145,7 @@ function drupal_xml_parser_create(&$data $out = drupal_convert_to_utf8($data, $encoding); if ($out !== FALSE) { $encoding = 'utf-8'; - $data = ereg_replace('^(<\?xml[^>]+encoding)="([^"]+)"', '\\1="utf-8"', $out); + $data = preg_replace('/^(<\?xml[^>]+encoding)="(.+?)"/', '\\1="utf-8"', $out); } else { watchdog('php', 'Could not convert XML encoding %s to UTF-8.', array('%s' => $encoding), WATCHDOG_WARNING); Index: modules/blogapi/blogapi.module =================================================================== RCS file: /cvs/drupal/drupal/modules/blogapi/blogapi.module,v retrieving revision 1.115.2.5 diff -u -p -r1.115.2.5 blogapi.module --- modules/blogapi/blogapi.module 8 Oct 2008 20:12:17 -0000 1.115.2.5 +++ modules/blogapi/blogapi.module 7 Apr 2009 20:17:56 -0000 @@ -689,13 +689,14 @@ function blogapi_validate_user($username * For the blogger API, extract the node title from the contents field. */ function blogapi_blogger_title(&$contents) { - if (eregi('([^<]*)', $contents, $title)) { + if (preg_match('/(.*?)<\/title>/i', $contents, $title)) { $title = strip_tags($title[0]); - $contents = ereg_replace('<title>[^<]*', '', $contents); + $contents = preg_replace('/.*?<\/title>/i', '', $contents); } else { list($title, $contents) = explode("\n", $contents, 2); } + return $title; } Index: modules/system/system.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.admin.inc,v retrieving revision 1.63.2.7 diff -u -p -r1.63.2.7 system.admin.inc --- modules/system/system.admin.inc 25 Feb 2009 11:38:41 -0000 1.63.2.7 +++ modules/system/system.admin.inc 7 Apr 2009 20:17:59 -0000 @@ -1971,7 +1971,7 @@ function theme_system_admin_by_module($m * 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) { Index: modules/upload/upload.module =================================================================== RCS file: /cvs/drupal/drupal/modules/upload/upload.module,v retrieving revision 1.197.2.4 diff -u -p -r1.197.2.4 upload.module --- modules/upload/upload.module 12 Jan 2009 15:30:23 -0000 1.197.2.4 +++ modules/upload/upload.module 7 Apr 2009 20:18:07 -0000 @@ -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'); Index: modules/user/user.module =================================================================== RCS file: /cvs/drupal/drupal/modules/user/user.module,v retrieving revision 1.892.2.12 diff -u -p -r1.892.2.12 user.module --- modules/user/user.module 25 Feb 2009 13:57:04 -0000 1.892.2.12 +++ modules/user/user.module 7 Apr 2009 20:18:16 -0000 @@ -378,25 +378,36 @@ function user_save($account, $array = ar * Verify the syntax of the given name. */ function user_validate_name($name) { - if (!strlen($name)) return t('You must enter a username.'); - if (substr($name, 0, 1) == ' ') return t('The username cannot begin with a space.'); - if (substr($name, -1) == ' ') return t('The username cannot end with a space.'); - if (strpos($name, ' ') !== FALSE) return t('The username cannot contain multiple spaces in a row.'); - if (ereg("[^\x80-\xF7 [:alnum:]@_.-]", $name)) return t('The username contains an illegal character.'); - if (preg_match('/[\x{80}-\x{A0}'. // Non-printable ISO-8859-1 + NBSP - '\x{AD}'. // Soft-hyphen - '\x{2000}-\x{200F}'. // Various space characters - '\x{2028}-\x{202F}'. // Bidirectional text overrides - '\x{205F}-\x{206F}'. // Various text hinting characters - '\x{FEFF}'. // Byte order mark - '\x{FF01}-\x{FF60}'. // Full-width latin - '\x{FFF9}-\x{FFFD}'. // Replacement characters - '\x{0}]/u', // NULL byte + if (!$name) { + return t('You must enter a username.'); + } + if (substr($name, 0, 1) == ' ') { + return t('The username cannot begin with a space.'); + } + if (substr($name, -1) == ' ') { + return t('The username cannot end with a space.'); + } + if (strpos($name, ' ') !== FALSE) { + return t('The username cannot contain multiple spaces in a row.'); + } + if (preg_match('/[^\x{80}-\x{F7} a-z0-9@_.\'-]/i', $name)) { + return t('The username contains an illegal character.'); + } + if (preg_match('/[\x{80}-\x{A0}' . // Non-printable ISO-8859-1 + NBSP + '\x{AD}' . // Soft-hyphen + '\x{2000}-\x{200F}' . // Various space characters + '\x{2028}-\x{202F}' . // Bidirectional text overrides + '\x{205F}-\x{206F}' . // Various text hinting characters + '\x{FEFF}' . // Byte order mark + '\x{FF01}-\x{FF60}' . // Full-width latin + '\x{FFF9}-\x{FFFD}' . // Replacement characters + '\x{0}-\x{1F}]/u', // NULL byte and control characters $name)) { return t('The username contains an illegal character.'); } - if (strpos($name, '@') !== FALSE && !eregi('@([0-9a-z](-?[0-9a-z])*.)+[a-z]{2}([zmuvtg]|fo|me)?$', $name)) return t('The username is not a valid authentication ID.'); - if (strlen($name) > USERNAME_MAX_LENGTH) return t('The username %name is too long: it must be %max characters or less.', array('%name' => $name, '%max' => USERNAME_MAX_LENGTH)); + if (drupal_strlen($name) > USERNAME_MAX_LENGTH) { + return t('The username %name is too long: it must be %max characters or less.', array('%name' => $name, '%max' => USERNAME_MAX_LENGTH)); + } } function user_validate_mail($mail) { @@ -1598,7 +1609,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); } /** @@ -1922,8 +1933,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'; + // we can't use neither module_invoke nor user_module_invoke because we need the return value and by reference + if (function_exists($function) && ($data = $function('categories', $null, $user, ''))) { $categories = array_merge($data, $categories); } } @@ -2460,9 +2475,13 @@ function user_register_validate($form, & */ function _user_forms(&$edit, $account, $category, $hook = 'form') { $groups = array(); + // only variables can be passed by reference workaround + $null = NULL; foreach (module_list() as $module) { - if ($data = module_invoke($module, 'user', $hook, $edit, $account, $category)) { - $groups = array_merge_recursive($data, $groups); + $function = $module .'_user'; + // we can't use neither module_invoke nor user_module_invoke because we need the return value and by reference + if (function_exists($function) && ($data = $function($hook, $null, $account, $category))) { + $groups = array_merge($data, $groups); } } uasort($groups, '_user_sort'); Index: modules/user/user.pages.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/user/user.pages.inc,v retrieving revision 1.11.2.1 diff -u -p -r1.11.2.1 user.pages.inc --- modules/user/user.pages.inc 8 Oct 2008 20:12:18 -0000 1.11.2.1 +++ modules/user/user.pages.inc 7 Apr 2009 20:18:17 -0000 @@ -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();