There was a change in common.inc in this patch http://drupal.org/node/14591.
When a user gets a 403, then menu_set_active_item('#'); is called in drupal_acces_denied.
Because of this the value of $_GET['q'] is lost.
The action of login block's form is "/%23?destination=%23". (%23 = url_encode('#'))

So user cannot be redireced to the originally requested page after succesful login.

Comments

Steven’s picture

StatusFileSize
new1.13 KB

Well, here's a patch which restores the destination... but for some reason it doesn't work for me for the log-in block. Somewhere along the it seems to get lost.

FWIW, this bug was already there before that 404/403 patch, if you used a custom 404/403 handler. Now it happens for everyone.

Steven’s picture

To clarify: the patch above restores the destination, and it correctly appears in the form action="..". But it is not being used by the form API.

chx’s picture

StatusFileSize
new371 bytes

What about this?

chx’s picture

Status: Active » Needs review
StatusFileSize
new1.45 KB

Steven drilled down to the core of this issue but run out of time, so I post instead

mod_rewrite decodes urlencoded characters when it performs its operations, which makes the %23 back into a real #. This disrupts normal semantics and prevents the query argument (the destination) from being parsed by PHP

Steven’s picture

StatusFileSize
new2.36 KB

Here's a slightly improved patch. Instead of a non-existant path like "^" or "#", I just changed menu_set_active_item() to distinguish NULL from an empty string. This does not affect any usage of menu_set_active_item() in core. The benefit is that there is no longer a 404 in the watchdog after submitting a form on a 404/403 page.

Tested to work for both clean and non-clean URLs.

chx’s picture

StatusFileSize
new2.35 KB

isset is faster than is_null.

Steven’s picture

Status: Needs review » Fixed

Committed to HEAD.

Anonymous’s picture

Status: Fixed » Closed (fixed)