diff options
author | Angie Byron <webchick@24967.no-reply.drupal.org> | 2010-02-17 22:44:52 +0000 |
---|---|---|
committer | Angie Byron <webchick@24967.no-reply.drupal.org> | 2010-02-17 22:44:52 +0000 |
commit | 8d01aeb4287be61195a43305e34f379086914f5d (patch) | |
tree | 88ef91e8532ed82085dfa5ce8a854116f891173b /modules/simpletest | |
parent | 8847f4c9a2edcd2f555d6a47b5037c88c671cc3c (diff) | |
download | brdo-8d01aeb4287be61195a43305e34f379086914f5d.tar.gz brdo-8d01aeb4287be61195a43305e34f379086914f5d.tar.bz2 |
#710142 by Berdir, moshe weitzman, chx: Handle exceptions in shutdown functions (with tests). Hopefully the last of these weird 'Stack frame in Unknown line 0' errors.
Diffstat (limited to 'modules/simpletest')
-rw-r--r-- | modules/simpletest/tests/system_test.module | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/modules/simpletest/tests/system_test.module b/modules/simpletest/tests/system_test.module index b37019f8c..a638b70f5 100644 --- a/modules/simpletest/tests/system_test.module +++ b/modules/simpletest/tests/system_test.module @@ -94,6 +94,13 @@ function system_test_menu() { 'type' => MENU_CALLBACK, ); + $items['system-test/shutdown-functions'] = array( + 'title' => 'Test main content duplication', + 'page callback' => 'system_test_page_shutdown_functions', + 'access callback' => TRUE, + 'type' => MENU_CALLBACK, + ); + return $items; } @@ -280,3 +287,29 @@ function system_test_main_content_fallback() { return t('Content to test main content fallback'); } +/** + * A simple page callback which adds a register shutdown function. + */ +function system_test_page_shutdown_functions($arg1, $arg2) { + drupal_register_shutdown_function('_system_test_first_shutdown_function', $arg1, $arg2); +} + +/** + * Dummy shutdown function which registers another shutdown function. + */ +function _system_test_first_shutdown_function($arg1, $arg2) { + // Output something, page has already been printed and the session stored + // so we can't use drupal_set_message. + print t('First shutdown function, arg1 : @arg1, arg2: @arg2', array('@arg1' => $arg1, '@arg2' => $arg2)); + drupal_register_shutdown_function('_system_test_second_shutdown_function', $arg1, $arg2); +} + +/** + * Dummy shutdown function. + */ +function _system_test_second_shutdown_function($arg1, $arg2) { + // Output something, page has already been printed and the session stored + // so we can't use drupal_set_message. + print t('Second shutdown function, arg1 : @arg1, arg2: @arg2', array('@arg1' => $arg1, '@arg2' => $arg2)); +} + |