diff --git a/core/includes/errors.inc b/core/includes/errors.inc index fa3bc6b..b66e640 100644 --- a/core/includes/errors.inc +++ b/core/includes/errors.inc @@ -169,7 +169,7 @@ function _drupal_log_error($error, $fatal = FALSE) { // When called from CLI, simply output a plain text message. // Should not translate the string to avoid errors producing more errors. print html_entity_decode(strip_tags(format_string('%type: !message in %function (line %line of %file).', $error))). "\n"; - exit; + return; } } @@ -180,7 +180,7 @@ function _drupal_log_error($error, $fatal = FALSE) { // Should not translate the string to avoid errors producing more errors. print format_string('%type: !message in %function (line %line of %file).', $error); } - exit; + return; } } else { diff --git a/core/modules/system/tests/modules/session_test/session_test.module b/core/modules/system/tests/modules/session_test/session_test.module index 6a08211..f5e23b9 100644 --- a/core/modules/system/tests/modules/session_test/session_test.module +++ b/core/modules/system/tests/modules/session_test/session_test.module @@ -1,13 +1,15 @@ getUsername() == 'session_test_user') { // Exit so we can verify that the session was regenerated - // before hook_user_login() was called. - exit; + // before hook_user() was called. + return new Response('OK', Response::HTTP_OK ); } // Add some data in the session for retrieval testing purpose. \Drupal::request()->getSession()->set("session_test_key", "foobar"); diff --git a/core/modules/system/tests/modules/url_alter_test/url_alter_test.module b/core/modules/system/tests/modules/url_alter_test/url_alter_test.module new file mode 100644 index 0000000..4637454 --- /dev/null +++ b/core/modules/system/tests/modules/url_alter_test/url_alter_test.module @@ -0,0 +1,70 @@ + 'Foo', + 'page callback' => 'url_alter_test_foo', + 'access arguments' => array('access content'), + 'type' => MENU_CALLBACK, + ); + return $items; +} + +/** + * Menu callback. + */ +function url_alter_test_foo() { + return new Response('current_path=' . current_path() . ' request_path=' . request_path(), 200); +} + +/** + * Implements hook_url_inbound_alter(). + */ +function url_alter_test_url_inbound_alter(&$path, $original_path, $path_language) { + if (!request_path() && current_path()) { + drupal_set_message("current_path() is non-empty with an empty request path."); + } + + // Rewrite user/username to user/uid. + if (preg_match('!^user/([^/]+)(/.*)?!', $path, $matches)) { + if ($account = user_load_by_name($matches[1])) { + $matches += array(2 => ''); + $path = 'user/' . $account->uid . $matches[2]; + } + } + + // Rewrite community/ to forum/. + if ($path == 'community' || strpos($path, 'community/') === 0) { + $path = 'forum' . substr($path, 9); + } + + if ($path == 'url-alter-test/bar') { + $path = 'url-alter-test/foo'; + } +} + +/** + * Implements hook_url_outbound_alter(). + */ +function url_alter_test_url_outbound_alter(&$path, &$options, $original_path) { + // Rewrite user/uid to user/username. + if (preg_match('!^user/([0-9]+)(/.*)?!', $path, $matches)) { + if ($account = user_load($matches[1])) { + $matches += array(2 => ''); + $path = 'user/' . $account->name . $matches[2]; + } + } + + // Rewrite forum/ to community/. + if ($path == 'forum' || strpos($path, 'forum/') === 0) { + $path = 'community' . substr($path, 5); + } +}