Download & Extend

custom 403 page returns "2", "3" etc. instead of node

Project:Drupal core
Version:5.1
Component:base system
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (duplicate)

Issue Summary

When I specify a custom error page and not found page (i.e node/403) and remove the permission to read content for anynomous user I got the following
page, when a required page wasn't found or the access is denied

.....
       <h1 class="title">content</h1>
        <div class="tabs"></div>
                        <!-- begin content -->3<!-- end content -->      </div>
....

Comments

#1

Same concept here on 4.7.2.

#2

It corrects if you add the correct alias, content (should exist) and access permissions for that item.

#3

Category:bug report» support request
Status:active» fixed

not a bug.

#4

Status:fixed» closed (fixed)

#5

Version:4.7.2» 4.7.4
Category:support request» bug report
Status:closed (fixed)» active

I get the same behaviour on 4.7.4. Anon users have no access to the site (access content perm is not granted for anon users). A custom 403 page exists (node/499). So I can't see how the solution proposed by 3dguru applies. A mysterious character '3' appears in the content instead of the content of node/499.

#6

Ok, I've looked at the code and I understand why this occurs, but I don't yet have a solution.

In the case where anon users have no access content perm, and a custom 403 page is defined, drupal_access_denied() in common.inc is executed. It gets the 'site_403' variable, and then calls menu_execute_active_handler() in menu.inc.

menu_execute_active_handler does a series of tests. The one we run into is

if (!_menu_item_is_accessible(menu_get_active_item())) {
    return MENU_ACCESS_DENIED;
  }

The value of MENU_ACCESS_DENIED is '3'.

This gets passed back to drupal_access_denied() and output to the page.

It seems to me that the 403 page should always be available to users, so either menu_execute_active_handler() should return the 403 page contents, or drupal_access_denied() should ignore the return value of 3...

#7

I believe 4.7.5 has a fix for this, can you test this on 4.7.5?

#8

Version:4.7.4» 4.7.5

I get the same behaviour on 4.7.5 as 4.7.4 (i.e. '3' appears)

#9

Version:4.7.5» 4.7.6

#10

Title:strange "content 3" page when specified a custom error and not found page» custom 403 page returns "2", "3" etc. instead of node
Version:4.7.6» 5.1

Was going to open a new issue but found this.

This seems to happen if you have a typo in the alias for your node - because it's not showing the node itself, but your 403 page, drupal doesn't show a page not found, but returns the "2".

I put the node/[nid] in - it worked fine.

I put the correct path for the node in - also fine.

Wondering if maybe a check for the alias could be done on the custom error handling page? Or maybe document this behaviour on that screen somewhere?

Something like "Drupal will return no content at all on 403 pages if you enter an invalid path for you custom page, so please double check".

#11

Same issue here-- getting the numeral 2 instead of an access denied page (due to improperly removed login toboggan).

Administer » Site configuration » Error reporting
admin/settings/error-reporting

is where this can be changed to working paths.

#12

Status:active» closed (duplicate)

Duplicate: http://drupal.org/node/84754

The other issue has a patch waiting to be ported, setting this one as dup.

nobody click here