diff --git a/core/modules/book/book.pages.inc b/core/modules/book/book.pages.inc index aedde16..94810a4 100644 --- a/core/modules/book/book.pages.inc +++ b/core/modules/book/book.pages.inc @@ -6,6 +6,7 @@ */ use Drupal\node\Node; +use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; /** * Page callback: Prints a listing of all books. @@ -88,7 +89,7 @@ function book_export_html($nid) { } } else { - drupal_access_denied(); + throw new AccessDeniedHttpException(); } } diff --git a/core/modules/contact/contact.pages.inc b/core/modules/contact/contact.pages.inc index bf096a7..774fab7 100644 --- a/core/modules/contact/contact.pages.inc +++ b/core/modules/contact/contact.pages.inc @@ -5,6 +5,8 @@ * Page callbacks for the Contact module. */ +use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; + /** * Form constructor for the site-wide contact form. * @@ -21,7 +23,7 @@ function contact_site_form($form, &$form_state) { $window = variable_get('contact_threshold_window', 3600); if (!flood_is_allowed('contact', $limit, $window) && !user_access('administer contact forms')) { drupal_set_message(t("You cannot send more than %limit messages in @interval. Try again later.", array('%limit' => $limit, '@interval' => format_interval($window))), 'error'); - drupal_access_denied(); + throw new AccessDeniedHttpException(); drupal_exit(); } @@ -183,7 +185,7 @@ function contact_personal_form($form, &$form_state, $recipient) { $window = variable_get('contact_threshold_window', 3600); if (!flood_is_allowed('contact', $limit, $window) && !user_access('administer contact forms') && !user_access('administer users')) { drupal_set_message(t("You cannot send more than %limit messages in @interval. Try again later.", array('%limit' => $limit, '@interval' => format_interval($window))), 'error'); - drupal_access_denied(); + throw new AccessDeniedHttpException(); drupal_exit(); } diff --git a/core/modules/image/image.module b/core/modules/image/image.module index 9d94ac2..0cd267d 100644 --- a/core/modules/image/image.module +++ b/core/modules/image/image.module @@ -7,6 +7,7 @@ use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\StreamedResponse; +use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; /** * Image style constant for user presets in the database. @@ -694,7 +695,7 @@ function image_style_deliver($style, $scheme) { else { $headers = module_invoke_all('file_download', $image_uri); if (in_array(-1, $headers) || empty($headers)) { - return drupal_access_denied(); + throw new AccessDeniedHttpException(); } if (count($headers)) { foreach ($headers as $name => $value) { diff --git a/core/modules/menu/menu.admin.inc b/core/modules/menu/menu.admin.inc index 2e1725d..33cbcf0 100644 --- a/core/modules/menu/menu.admin.inc +++ b/core/modules/menu/menu.admin.inc @@ -5,6 +5,8 @@ * Administrative page callbacks for menu module. */ +use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; + /** * Menu callback which shows an overview page of all the custom menus and their descriptions. */ @@ -506,7 +508,7 @@ function menu_delete_menu_page($menu) { // System-defined menus may not be deleted. $system_menus = menu_list_system_menus(); if (isset($system_menus[$menu['menu_name']])) { - drupal_access_denied(); + throw new AccessDeniedHttpException(); return; } return drupal_get_form('menu_delete_menu_confirm', $menu); @@ -616,7 +618,7 @@ function menu_item_delete_page($item) { // Links defined via hook_menu may not be deleted. Updated items are an // exception, as they can be broken. if ($item['module'] == 'system' && !$item['updated']) { - drupal_access_denied(); + throw new AccessDeniedHttpException(); return; } return drupal_get_form('menu_item_delete_form', $item); diff --git a/core/modules/shortcut/shortcut.admin.inc b/core/modules/shortcut/shortcut.admin.inc index 9010f90..9f1888a 100644 --- a/core/modules/shortcut/shortcut.admin.inc +++ b/core/modules/shortcut/shortcut.admin.inc @@ -5,6 +5,8 @@ * Administrative page callbacks for the shortcut module. */ +use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; + /** * Returns the maximum number of shortcut "slots" available per shortcut set. * @@ -775,5 +777,5 @@ function shortcut_link_add_inline($shortcut_set) { drupal_goto(); } - return drupal_access_denied(); + throw new AccessDeniedHttpException(); } diff --git a/core/modules/system/system.admin.inc b/core/modules/system/system.admin.inc index a31e278..33c89f5 100644 --- a/core/modules/system/system.admin.inc +++ b/core/modules/system/system.admin.inc @@ -6,6 +6,7 @@ */ use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; /** * Menu callback; Provide the administration overview page. @@ -280,7 +281,7 @@ function system_theme_enable() { } drupal_goto('admin/appearance'); } - return drupal_access_denied(); + throw new AccessDeniedHttpException(); } /** @@ -308,7 +309,7 @@ function system_theme_disable() { } drupal_goto('admin/appearance'); } - return drupal_access_denied(); + throw new AccessDeniedHttpException(); } /** @@ -355,7 +356,7 @@ function system_theme_default() { } drupal_goto('admin/appearance'); } - return drupal_access_denied(); + throw new AccessDeniedHttpException(); } /** @@ -2303,7 +2304,7 @@ function system_batch_page() { $output = _batch_page(); if ($output === FALSE) { - drupal_access_denied(); + throw new AccessDeniedHttpException(); } elseif ($output instanceof Response) { return $output; diff --git a/core/modules/user/user.pages.inc b/core/modules/user/user.pages.inc index 300bbc1..fcda92e 100644 --- a/core/modules/user/user.pages.inc +++ b/core/modules/user/user.pages.inc @@ -5,6 +5,8 @@ * User page callback file for the user module. */ +use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; + /** * Menu callback; Retrieve a JSON object containing autocomplete suggestions for existing users. */ @@ -157,7 +159,7 @@ function user_pass_reset($form, &$form_state, $uid, $timestamp, $hashed_pass, $a else { // Deny access, no more clues. // Everything will be in the watchdog's URL for the administrator to check. - drupal_access_denied(); + throw new AccessDeniedHttpException(); } } } @@ -480,7 +482,7 @@ function user_cancel_confirm($account, $timestamp = 0, $hashed_pass = '') { drupal_goto("user/$account->uid/cancel"); } } - drupal_access_denied(); + throw new AccessDeniedHttpException(); } /**