I have an empty_page callback set up at "/home" which works perfectly for the site front page. However setting the site 403 page to "/home" does not prevent the site's default "Access Denied" title and message from displaying.

CommentFileSizeAuthor
#4 emptypage-40x.patch1.89 KBbleen

Comments

bleen’s picture

I dont believe you can override the default behavior of Acces Denied in this way. Access checks happen long before the empty_page module gets its hands on the request.

I'm 99% sure I'm right about this too...

bleen’s picture

Status: Active » Closed (works as designed)

Please re-open if you have any evidence to contradict my comments in #1

Nick Robillard’s picture

Title: Empty page does not work when set as 403 page » Empty page does not work when set as 403 or 404 page
Status: Closed (works as designed) » Needs work

Actually this is a legitimate issue. And the fix is quite simple. For D7, I tracked it down to drupal_deliver_html_page() in common.inc:
(... indicates code removed for readability purposes)

<?php
switch ($page_callback_result) {
      case MENU_NOT_FOUND:
        // Print a 404 page.
        ...
        $path = drupal_get_normal_path(variable_get('site_404', ''));
        if ($path && $path != $_GET['q']) {
          // Custom 404 handler. Set the active item in case there are tabs to
          // display, or other dependencies on the path.
          menu_set_active_item($path);
          $return = menu_execute_active_handler($path, FALSE);
        }

        if (empty($return) || $return == MENU_NOT_FOUND || $return == MENU_ACCESS_DENIED) {
          // Standard 404 handler.
          drupal_set_title(t('Page not found'));
          $return = t('The requested page could not be found.');
        }
?>

The if (empty($return) check always returns TRUE because our menu callback is always empty. :)

<?php
function empty_page_empty() {
  return '';
}
?>

All that needs to be done to fix this is changing the return to ' ' (a space) instead of ''. This should also be the case for D6 version. I don't have time to commit this right now. bleen18 if you feel like making this change for Drupal 6 and 7 dev versions, go ahead.

Nice catch carn1x.

bleen’s picture

Status: Needs work » Fixed
StatusFileSize
new1.89 KB
carn1x’s picture

Awesome thanks a bunch :)

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.