diff options
author | Dries Buytaert <dries@buytaert.net> | 2010-04-11 18:33:44 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2010-04-11 18:33:44 +0000 |
commit | ff301288f2ea06d76606c05bccac5957e2873a94 (patch) | |
tree | b46d9d7e56612945850281a136161967ba8bc5f2 /modules | |
parent | de33f74b4040cc3f7880269152b277d90b081cc8 (diff) | |
download | brdo-ff301288f2ea06d76606c05bccac5957e2873a94.tar.gz brdo-ff301288f2ea06d76606c05bccac5957e2873a94.tar.bz2 |
- Patch #348448 by mfb, c960657, marvil07, cdale, jpmckinney: fixed PHP strict warnings when running tests and for PHP 5.3.
Diffstat (limited to 'modules')
25 files changed, 93 insertions, 47 deletions
diff --git a/modules/book/book.module b/modules/book/book.module index 73c348942..9d5938331 100644 --- a/modules/book/book.module +++ b/modules/book/book.module @@ -745,7 +745,11 @@ function book_children($book_link) { } } - return $children ? drupal_render(menu_tree_output($children)) : ''; + if ($children) { + $elements = menu_tree_output($children); + return drupal_render($elements); + } + return ''; } /** diff --git a/modules/color/color.test b/modules/color/color.test index d487be24b..43cdb4aa2 100644 --- a/modules/color/color.test +++ b/modules/color/color.test @@ -37,9 +37,8 @@ class ColorTestCase extends DrupalWebTestCase { $edit['palette[link]'] = '#123456'; $this->drupalPost('admin/appearance/settings/garland', $edit, t('Save configuration')); - global $theme_key; $this->drupalGet('<front>'); - $stylesheets = variable_get('color_' . $theme_key . '_stylesheets', array()); + $stylesheets = variable_get('color_garland_stylesheets', array()); $this->assertPattern('|' . file_create_url($stylesheets[0]) . '|', 'Make sure the color stylesheet is included in the content.'); $stylesheet_content = join("\n", file($stylesheets[0])); @@ -52,7 +51,7 @@ class ColorTestCase extends DrupalWebTestCase { $this->drupalPost('admin/appearance/settings/garland', $edit, t('Save configuration')); $this->drupalGet('<front>'); - $stylesheets = variable_get('color_' . $theme_key . '_stylesheets', array()); + $stylesheets = variable_get('color_garland_stylesheets', array()); $stylesheet_content = join("\n", file($stylesheets[0])); $matched = preg_match('/(.*color: #0c7a00.*)/i', $stylesheet_content, $matches); $this->assertTrue($matched == 1, 'Make sure the color we changed is in the color stylesheet.'); diff --git a/modules/field/tests/field.test b/modules/field/tests/field.test index 78afaf16f..b24dc9ea7 100644 --- a/modules/field/tests/field.test +++ b/modules/field/tests/field.test @@ -15,12 +15,13 @@ class FieldTestCase extends DrupalWebTestCase { /** * Set the default field storage backend for fields created during tests. */ - function setUp($modules = array()) { + function setUp() { // Since this is a base class for many test cases, support the same // flexibility that DrupalWebTestCase::setUp() has for the modules to be // passed in as either an array or a variable number of string arguments. - if (!is_array($modules)) { - $modules = func_get_args(); + $modules = func_get_args(); + if (isset($modules[0]) && is_array($modules[0])) { + $modules = $modules[0]; } parent::setUp($modules); // Set default storage backend. diff --git a/modules/field_ui/field_ui.admin.inc b/modules/field_ui/field_ui.admin.inc index a775a71f9..f0c92578f 100644 --- a/modules/field_ui/field_ui.admin.inc +++ b/modules/field_ui/field_ui.admin.inc @@ -655,6 +655,7 @@ function template_preprocess_field_ui_display_overview_form(&$vars) { $row = new stdClass(); foreach (element_children($element) as $child) { if (array_key_exists('label', $element[$child])) { + $row->{$child} = new stdClass(); $row->{$child}->label = drupal_render($element[$child]['label']); $row->{$child}->type = drupal_render($element[$child]['type']); } diff --git a/modules/filter/filter.test b/modules/filter/filter.test index 7a26a72db..fcc026d5a 100644 --- a/modules/filter/filter.test +++ b/modules/filter/filter.test @@ -1244,7 +1244,8 @@ alert("test") $this->assertEqual($f, ''', t('The @function() function correctly filters single quotes.', $replacements)); // Test that the filter is not fooled by different evasion techniques. - $f = $function("\xc2\""); + // Ignore PHP 5.3+ invalid multibyte sequence warning. + $f = @$function("\xc2\""); $this->assertEqual($f, '', t('The @function() function correctly filters invalid UTF-8.', $replacements)); } } diff --git a/modules/forum/forum.module b/modules/forum/forum.module index 439b6b7e5..c278c946b 100644 --- a/modules/forum/forum.module +++ b/modules/forum/forum.module @@ -322,7 +322,8 @@ function forum_node_presave($node) { if (_forum_node_check_node_type($node)) { // Make sure all fields are set properly: $node->icon = !empty($node->icon) ? $node->icon : ''; - $langcode = array_shift(array_keys($node->taxonomy_forums)); + reset($node->taxonomy_forums); + $langcode = key($node->taxonomy_forums); if (!empty($node->taxonomy_forums[$langcode])) { $node->forum_tid = $node->taxonomy_forums[$langcode][0]['tid']; $old_tid = db_query_range("SELECT f.tid FROM {forum} f INNER JOIN {node} n ON f.vid = n.vid WHERE n.nid = :nid ORDER BY f.vid DESC", 0, 1, array(':nid' => $node->nid))->fetchField(); diff --git a/modules/image/image.test b/modules/image/image.test index 6790b7954..42ec0ad4d 100644 --- a/modules/image/image.test +++ b/modules/image/image.test @@ -248,7 +248,7 @@ class ImageEffectsUnitTest extends ImageToolkitTestCase { */ class ImageAdminStylesUnitTest extends DrupalWebTestCase { - function getInfo() { + public static function getInfo() { return array( 'name' => 'Image styles and effects UI configuration', 'description' => 'Tests creation, deletion, and editing of image styles and effects at the UI level.', diff --git a/modules/locale/locale.admin.inc b/modules/locale/locale.admin.inc index da771a746..b19fce111 100644 --- a/modules/locale/locale.admin.inc +++ b/modules/locale/locale.admin.inc @@ -783,7 +783,8 @@ function locale_translate_seek_screen() { // Add CSS. drupal_add_css(drupal_get_path('module', 'locale') . '/locale.css', array('preprocess' => FALSE)); - $output = drupal_render(drupal_get_form('locale_translation_filter_form')); + $elements = drupal_get_form('locale_translation_filter_form'); + $output = drupal_render($elements); $output .= _locale_translate_seek(); return $output; } @@ -1023,9 +1024,11 @@ function locale_translate_export_screen() { $output = ''; // Offer translation export if any language is set up. if (count($names)) { - $output = drupal_render(drupal_get_form('locale_translate_export_po_form', $names)); + $elements = drupal_get_form('locale_translate_export_po_form', $names); + $output = drupal_render($elements); } - $output .= drupal_render(drupal_get_form('locale_translate_export_pot_form')); + $elements = drupal_get_form('locale_translate_export_pot_form'); + $output .= drupal_render($elements); return $output; } @@ -1354,6 +1357,7 @@ function locale_date_format_form($form, &$form_state, $langcode) { $choices[$f] = format_date(REQUEST_TIME, 'custom', $f); } } + reset($formats); // Get configured formats for each language. $locale_formats = system_date_format_locale($langcode); @@ -1363,7 +1367,7 @@ function locale_date_format_form($form, &$form_state, $langcode) { $default = $locale_formats[$type]; } else { - $default = variable_get('date_format_' . $type, array_shift(array_keys($formats))); + $default = variable_get('date_format_' . $type, key($formats)); } // Show date format select list. diff --git a/modules/node/node.module b/modules/node/node.module index 9aa9cd622..dd67cbda7 100644 --- a/modules/node/node.module +++ b/modules/node/node.module @@ -3600,7 +3600,8 @@ function node_unpublish_by_keyword_action_submit($form, $form_state) { */ function node_unpublish_by_keyword_action($node, $context) { foreach ($context['keywords'] as $keyword) { - if (strpos(drupal_render(node_view(clone $node)), $keyword) !== FALSE || strpos($node->title, $keyword) !== FALSE) { + $elements = node_view(clone $node); + if (strpos(drupal_render($elements), $keyword) !== FALSE || strpos($node->title, $keyword) !== FALSE) { $node->status = NODE_NOT_PUBLISHED; watchdog('action', 'Set @type %title to unpublished.', array('@type' => node_type_get_name($node), '%title' => $node->title)); break; diff --git a/modules/node/node.pages.inc b/modules/node/node.pages.inc index c1db541b7..a6d5c0a0b 100644 --- a/modules/node/node.pages.inc +++ b/modules/node/node.pages.inc @@ -355,8 +355,10 @@ function theme_node_preview($variables) { $preview_trimmed_version = FALSE; - $trimmed = drupal_render(node_view(clone $node, 'teaser')); - $full = drupal_render(node_view($node, 'full')); + $elements = node_view(clone $node, 'teaser'); + $trimmed = drupal_render($elements); + $elements = node_view($node, 'full'); + $full = drupal_render($elements); // Do we need to preview trimmed version of post as well as full version? if ($trimmed != $full) { diff --git a/modules/openid/openid.inc b/modules/openid/openid.inc index 14a28486f..2957699ac 100644 --- a/modules/openid/openid.inc +++ b/modules/openid/openid.inc @@ -90,7 +90,8 @@ function openid_redirect_http($url, $message) { */ function openid_redirect($url, $message) { $output = '<html><head><title>' . t('OpenID redirect') . "</title></head>\n<body>"; - $output .= drupal_render(drupal_get_form('openid_redirect_form', $url, $message)); + $elements = drupal_get_form('openid_redirect_form', $url, $message); + $output .= drupal_render($elements); $output .= '<script type="text/javascript">document.getElementById("openid-redirect-form").submit();</script>'; $output .= "</body></html>\n"; print $output; diff --git a/modules/poll/poll.module b/modules/poll/poll.module index 38fa77495..7d012e6fd 100644 --- a/modules/poll/poll.module +++ b/modules/poll/poll.module @@ -842,7 +842,8 @@ function theme_poll_choices($variables) { function template_preprocess_poll_results(&$variables) { $variables['links'] = theme('links__poll_results', array('links' => $variables['raw_links'])); if (isset($variables['vote']) && $variables['vote'] > -1 && user_access('cancel own vote')) { - $variables['cancel_form'] = drupal_render(drupal_get_form('poll_cancel_form', $variables['nid'])); + $elements = drupal_get_form('poll_cancel_form', $variables['nid']); + $variables['cancel_form'] = drupal_render($elements); } $variables['title'] = check_plain($variables['raw_title']); diff --git a/modules/rdf/rdf.test b/modules/rdf/rdf.test index f6b28c27a..876c07e71 100644 --- a/modules/rdf/rdf.test +++ b/modules/rdf/rdf.test @@ -246,7 +246,7 @@ class RdfCrudTestCase extends DrupalWebTestCase { } } -class RdfMappingDefinitionTestCase extends DrupalWebTestCase { +class RdfMappingDefinitionTestCase extends TaxonomyWebTestCase { public static function getInfo() { return array( 'name' => 'RDF mapping definition functionality', @@ -356,8 +356,8 @@ class RdfMappingDefinitionTestCase extends DrupalWebTestCase { * Creates a random term and ensures the right RDFa markup is used. */ function testTaxonomyTermRdfaAttributes() { - $vocabulary = TaxonomyWebTestCase::createVocabulary(); - $term = TaxonomyWebTestCase::createTerm($vocabulary); + $vocabulary = $this->createVocabulary(); + $term = $this->createTerm($vocabulary); // Views the term and checks that the RDFa markup is correct. $this->drupalGet('taxonomy/term/' . $term->tid); @@ -394,7 +394,11 @@ class RdfCommentAttributesTestCase extends DrupalWebTestCase { public function testAttributesInTeaser() { $node = $this->drupalCreateNode(array('type' => 'article', 'uid' => 1, 'promote' => 1)); - CommentHelperCase::postComment($node, $this->randomName(), $this->randomName()); + $comment = array( + 'subject' => $this->randomName(), + 'comment_body[' . LANGUAGE_NONE . '][0][value]' => $this->randomName(), + ); + $this->drupalPost('comment/reply/' . $node->nid, $comment, t('Save')); $this->drupalGet(''); $comment_count_link = $this->xpath('//div[@about=:url]//a[contains(@property, "sioc:num_replies") and @rel=""]', array(':url' => url("node/$node->nid"))); $this->assertTrue(!empty($comment_count_link), t('Empty rel attribute found in comment count link.')); @@ -491,7 +495,11 @@ class RdfTrackerAttributesTestCase extends DrupalWebTestCase { // Tests that the appropriate RDFa markup to annotate the latest activity // date has been added to the tracker output after a comment is posted. - CommentHelperCase::postComment($node, $this->randomName(), $this->randomName()); + $comment = array( + 'subject' => $this->randomName(), + 'comment_body[' . LANGUAGE_NONE . '][0][value]' => $this->randomName(), + ); + $this->drupalPost('comment/reply/' . $node->nid, $comment, t('Save')); $this->drupalGet('tracker'); // Tests whether the property has been set for number of comments. diff --git a/modules/simpletest/drupal_web_test_case.php b/modules/simpletest/drupal_web_test_case.php index 2c6d9c919..2db22c06b 100644 --- a/modules/simpletest/drupal_web_test_case.php +++ b/modules/simpletest/drupal_web_test_case.php @@ -1102,7 +1102,7 @@ class DrupalWebTestCase extends DrupalTestCase { * List of modules to enable for the duration of the test. This can be * either a single array or a variable number of string arguments. */ - protected function setUp($modules = array()) { + protected function setUp() { global $db_prefix, $user, $language, $conf; // Store necessary current values before switching to prefixed database. @@ -1166,8 +1166,9 @@ class DrupalWebTestCase extends DrupalTestCase { // either a single array argument or a variable number of string arguments. // @todo Remove this compatibility layer in Drupal 8, and only accept // $modules as a single array argument. - if (!is_array($modules)) { - $modules = func_get_args(); + $modules = func_get_args(); + if (isset($modules[0]) && is_array($modules[0])) { + $modules = $modules[0]; } if ($modules) { module_enable($modules, TRUE); @@ -1203,6 +1204,7 @@ class DrupalWebTestCase extends DrupalTestCase { variable_set('install_task', 'done'); variable_set('clean_url', $clean_url_original); variable_set('site_mail', 'simpletest@example.com'); + variable_set('date_default_timezone', date_default_timezone_get()); // Set up English language. unset($GLOBALS['conf']['language_default']); $language = language_default(); @@ -1742,7 +1744,8 @@ class DrupalWebTestCase extends DrupalTestCase { $wrapperNode = $xpath->query('//*[@id="' . $ajax_settings['wrapper'] . '"]')->item(0); if ($wrapperNode) { // ajax.js adds an enclosing DIV to work around a Safari bug. - $newDom = DOMDocument::loadHTML('<div>' . $command['data'] . '</div>'); + $newDom = new DOMDocument(); + $newDom->loadHTML('<div>' . $command['data'] . '</div>'); $newNode = $dom->importNode($newDom->documentElement->firstChild->firstChild, TRUE); $method = isset($command['method']) ? $command['method'] : $ajax_settings['method']; // The "method" is a jQuery DOM manipulation function. Emulate each diff --git a/modules/simpletest/tests/ajax.test b/modules/simpletest/tests/ajax.test index f6e2e28de..c10b8362b 100644 --- a/modules/simpletest/tests/ajax.test +++ b/modules/simpletest/tests/ajax.test @@ -2,7 +2,11 @@ // $Id$ class AJAXTestCase extends DrupalWebTestCase { - function setUp($modules = array()) { + function setUp() { + $modules = func_get_args(); + if (isset($modules[0]) && is_array($modules[0])) { + $modules = $modules[0]; + } parent::setUp(array_unique(array_merge(array('ajax_test', 'ajax_forms_test'), $modules))); } @@ -26,7 +30,7 @@ class AJAXTestCase extends DrupalWebTestCase { * Tests primary AJAX framework functions. */ class AJAXFrameworkTestCase extends AJAXTestCase { - function getInfo() { + public static function getInfo() { return array( 'name' => 'AJAX framework', 'description' => 'Performs tests on AJAX framework functions.', @@ -66,7 +70,7 @@ class AJAXFrameworkTestCase extends AJAXTestCase { * Tests AJAX framework commands. */ class AJAXCommandsTestCase extends AJAXTestCase { - function getInfo() { + public static function getInfo() { return array( 'name' => 'AJAX commands', 'description' => 'Performs tests on AJAX framework commands.', diff --git a/modules/simpletest/tests/common.test b/modules/simpletest/tests/common.test index c6d0d6369..9eaefe168 100644 --- a/modules/simpletest/tests/common.test +++ b/modules/simpletest/tests/common.test @@ -323,7 +323,8 @@ class CommonXssUnitTest extends DrupalUnitTestCase { * Check that invalid multi-byte sequences are rejected. */ function testInvalidMultiByte() { - $text = check_plain("Foo\xC0barbaz"); + // Ignore PHP 5.3+ invalid multibyte sequence warning. + $text = @check_plain("Foo\xC0barbaz"); $this->assertEqual($text, '', 'check_plain() rejects invalid sequence "Foo\xC0barbaz"'); $text = check_plain("Fooÿñ"); $this->assertEqual($text, "Fooÿñ", 'check_plain() accepts valid sequence "Fooÿñ"'); @@ -1774,6 +1775,8 @@ class FormatDateUnitTest extends DrupalWebTestCase { $user = user_load($test_user->uid, TRUE); $real_language = $language->language; $language->language = $user->language; + // Simulate a Drupal bootstrap with the logged-in user. + date_default_timezone_set(drupal_get_user_timezone()); $this->assertIdentical(format_date($timestamp, 'custom', 'l, d-M-y H:i:s T', 'America/Los_Angeles', 'en'), 'Sunday, 25-Mar-07 17:00:00 PDT', t('Test a different language.')); $this->assertIdentical(format_date($timestamp, 'custom', 'l, d-M-y H:i:s T', 'Europe/London'), 'Monday, 26-Mar-07 01:00:00 BST', t('Test a different time zone.')); @@ -1786,6 +1789,8 @@ class FormatDateUnitTest extends DrupalWebTestCase { // Restore the original user and language, and enable session saving. $user = $real_user; $language->language = $real_language; + // Restore default time zone. + date_default_timezone_set(drupal_get_user_timezone()); drupal_save_session(TRUE); } } diff --git a/modules/simpletest/tests/database_test.test b/modules/simpletest/tests/database_test.test index 95ebc1ca5..59080c713 100644 --- a/modules/simpletest/tests/database_test.test +++ b/modules/simpletest/tests/database_test.test @@ -3160,7 +3160,7 @@ class DatabaseExtraTypesTestCase extends DrupalWebTestCase { * Check the sequences API. */ class DatabaseNextIdCase extends DrupalWebTestCase { - function getInfo() { + public static function getInfo() { return array( 'name' => t('Sequences API'), 'description' => t('Test the secondary sequences API.'), @@ -3187,7 +3187,7 @@ class DatabaseNextIdCase extends DrupalWebTestCase { * Tests the empty pseudo-statement class. */ class DatabaseEmptyStatementTestCase extends DrupalWebTestCase { - function getInfo() { + public static function getInfo() { return array( 'name' => t('Empty statement'), 'description' => t('Test the empty pseudo-statement class.'), diff --git a/modules/simpletest/tests/file.test b/modules/simpletest/tests/file.test index abd1c2cbf..939430d72 100644 --- a/modules/simpletest/tests/file.test +++ b/modules/simpletest/tests/file.test @@ -1946,10 +1946,13 @@ class FileDownloadTest extends FileTestCase { function testFileCreateUrl() { global $base_url; - $basename = " -._~!$'\"()*@[]?&+%#,;=:\n\x00" . // "Special" ASCII characters. + // Tilde (~) is excluded from this test because it is encoded by + // rawurlencode() in PHP 5.2 but not in PHP 5.3, as per RFC 3986. + // @see http://www.php.net/manual/en/function.rawurlencode.php#86506 + $basename = " -._!$'\"()*@[]?&+%#,;=:\n\x00" . // "Special" ASCII characters. "%23%25%26%2B%2F%3F" . // Characters that look like a percent-escaped string. "éøïвβ中國書۞"; // Characters from various non-ASCII alphabets. - $basename_encoded = '%20-._%7E%21%24%27%22%28%29%2A%40%5B%5D%3F%26%2B%25%23%2C%3B%3D%3A__' . + $basename_encoded = '%20-._%21%24%27%22%28%29%2A%40%5B%5D%3F%26%2B%25%23%2C%3B%3D%3A__' . '%2523%2525%2526%252B%252F%253F' . '%C3%A9%C3%B8%C3%AF%D0%B2%CE%B2%E4%B8%AD%E5%9C%8B%E6%9B%B8%DB%9E'; diff --git a/modules/simpletest/tests/form.test b/modules/simpletest/tests/form.test index c5639be87..87374dd00 100644 --- a/modules/simpletest/tests/form.test +++ b/modules/simpletest/tests/form.test @@ -843,7 +843,7 @@ class FormsRebuildTestCase extends DrupalWebTestCase { */ class FormsProgrammaticTestCase extends DrupalWebTestCase { - function getInfo() { + public static function getInfo() { return array( 'name' => 'Programmatic form submissions', 'description' => 'Test the programmatic form submission behavior.', @@ -908,7 +908,7 @@ class FormsProgrammaticTestCase extends DrupalWebTestCase { */ class FormsClickedButtonTestCase extends DrupalWebTestCase { - function getInfo() { + public static function getInfo() { return array( 'name' => 'Form clicked button determination', 'description' => 'Test the determination of $form_state[\'clicked_button\'].', diff --git a/modules/simpletest/tests/form_test.module b/modules/simpletest/tests/form_test.module index d189fe56b..11a76534e 100644 --- a/modules/simpletest/tests/form_test.module +++ b/modules/simpletest/tests/form_test.module @@ -508,10 +508,10 @@ function form_test_storage_form_submit($form, &$form_state) { $form_state['redirect'] = 'node'; } - /** +/** * A form for testing form labels and required marks. */ -function form_label_test_form(&$form_state) { +function form_label_test_form() { $form['form_checkboxes_test'] = array( '#type' => 'checkboxes', '#title' => t('Checkboxes test'), diff --git a/modules/simpletest/tests/mail.test b/modules/simpletest/tests/mail.test index 5db3abb7e..48b61c3c7 100644 --- a/modules/simpletest/tests/mail.test +++ b/modules/simpletest/tests/mail.test @@ -13,7 +13,7 @@ class MailTestCase extends DrupalWebTestCase implements MailSystemInterface { */ private static $sent_message; - function getInfo() { + public static function getInfo() { return array( 'name' => 'Mail system', 'description' => 'Performs tests on the pluggable mailing framework.', diff --git a/modules/system/system.admin.inc b/modules/system/system.admin.inc index e2b79a9e0..3ca45af48 100644 --- a/modules/system/system.admin.inc +++ b/modules/system/system.admin.inc @@ -369,7 +369,7 @@ function system_theme_enable() { if (isset($_REQUEST['theme']) && isset($_REQUEST['token']) && drupal_valid_token($_REQUEST['token'], 'system-theme-operation-link')) { $theme = $_REQUEST['theme']; // Get current list of themes. - $themes =& _system_theme_list(); + $themes = _system_theme_list(); // Check if the specified theme is one recognized by the system. if (!empty($themes[$theme])) { @@ -391,7 +391,7 @@ function system_theme_disable() { if (isset($_REQUEST['theme']) && isset($_REQUEST['token']) && drupal_valid_token($_REQUEST['token'], 'system-theme-operation-link')) { $theme = $_REQUEST['theme']; // Get current list of themes. - $themes =& _system_theme_list(); + $themes = _system_theme_list(); // Check if the specified theme is one recognized by the system. if (!empty($themes[$theme])) { @@ -419,7 +419,7 @@ function system_theme_default() { if (isset($_REQUEST['theme']) && isset($_REQUEST['token']) && drupal_valid_token($_REQUEST['token'], 'system-theme-operation-link')) { $theme = $_REQUEST['theme']; // Get current list of themes. - $themes =& _system_theme_list(); + $themes = _system_theme_list(); // Check if the specified theme is one recognized by the system. if (!empty($themes[$theme])) { @@ -1947,7 +1947,8 @@ function system_date_time_settings() { foreach ($formats as $f => $format) { $choices[$f] = format_date(REQUEST_TIME, 'custom', $f); } - $default = variable_get('date_format_' . $type, array_shift(array_keys($formats))); + reset($formats); + $default = variable_get('date_format_' . $type, key($formats)); // Get date type info for this date type. $type_info = system_get_date_types($type); diff --git a/modules/system/system.test b/modules/system/system.test index dd7b44699..6fb15a736 100644 --- a/modules/system/system.test +++ b/modules/system/system.test @@ -1743,6 +1743,7 @@ class CompactModeTest extends DrupalWebTestCase { } function setUp() { + parent::setUp(); $admin_user = $this->drupalCreateUser(array('access administration pages')); $this->drupalLogin($admin_user); } diff --git a/modules/trigger/trigger.module b/modules/trigger/trigger.module index ebbc538b5..93ed2485c 100644 --- a/modules/trigger/trigger.module +++ b/modules/trigger/trigger.module @@ -488,7 +488,8 @@ function trigger_user_login(&$edit, $account, $category) { * Implements hook_user_logout(). */ function trigger_user_logout($account) { - _trigger_user('user_logout', $edit = NULL, $account); + $edit = NULL; + _trigger_user('user_logout', $edit, $account); } /** @@ -534,7 +535,8 @@ function trigger_user_delete($account) { * Implements hook_user_view(). */ function trigger_user_view($account) { - _trigger_user('user_view', $edit = NULL, $account, NULL); + $edit = NULL; + _trigger_user('user_view', $edit, $account, NULL); } /** diff --git a/modules/user/user.module b/modules/user/user.module index dc1c0c1d4..1ba829a0b 100644 --- a/modules/user/user.module +++ b/modules/user/user.module @@ -370,6 +370,9 @@ function user_save($account, $edit = array(), $category = 'account') { field_attach_presave('user', $edit); $edit = (array) $edit; + if (empty($account)) { + $account = new stdClass(); + } if (!isset($account->is_new)) { $account->is_new = empty($account->uid); } |