The patch that was introduced in the drupal 6.15 core to fix this problem, was not sufficient. It effectively fixed the search BLOCK on a 404 page, but did not fix the problem when using:
<?php
print $search_box;
?>in your template files.
The issue was fixed by removing some very strange lines in the /includes/common.inc, introduced by the previous patch... The lines are truly weird (and maybe were not ment to go into the patch?) since the added lines in the search.module sort of 'counter these'...
Tested and confirmed to be working:
- search on 404 for BLOCK
- search on 404 for $search_box
- login on 403
Patch attached...
| Comment | File | Size | Author |
|---|---|---|---|
| #15 | search_404_non_block_fix.d6_x.patch | 839 bytes | malc0mn |
| #14 | search_404_non_block_fix.d6_x.patch | 428 bytes | malc0mn |
| #13 | search_404_non_block_fix.d6_x.patch | 478 bytes | malc0mn |
| #9 | search_404_non_block_fix.d6_15.patch | 621 bytes | malc0mn |
| #1 | search_404_non_block_fix.patch | 621 bytes | malc0mn |
Comments
Comment #1
malc0mn commentedPatch here (did not seem to be attached to the initial post?).
Comment #2
geerlingguy commentedSubscribe. I'm tempted to mark as critical :)
I will review this patch as soon as I can.
Comment #3
pwolanin commentedThose lines were added to handle redirect on user login I think - the correct fix is probably elsewhere
Comment #4
gábor hojtsyThese lines already have a rich and convoluted history, see #292565: Regression: Can't set /user to 403 page (was: login destination is broken), which started with the same issue and then resulted in multiple storms.
Comment #5
gábor hojtsyCrosspost.
Comment #6
geerlingguy commentedEek! Well, the patch fixes my short-term problem, and since my site doesn't use the login block (but rather a context-aware login link, it's not a huge deal... we should maybe try having a test for both of these use cases...?
[Edit: I've tested the login destination from a 403 Access Denied page (where I printed the login form), as well as from 404 pages, and nothing seems to be broken... what's the specific issue?]
Comment #8
malc0mn commented@4: I read the thread, but those lines still seem obsolete to me. As reported in the issue:
Tested and confirmed to be working:
- search on 404 for BLOCK
- search on 404 for $search_box
- login on 403
@6: Agreed, tested and nothing found to be broken...
@7:
Any clue why the patch fails? Can't see why... I'll redo it if I know how to fix it...EDIT: I assume it fails on D7? I'll check if it's needed there as well, this patch was for 6.15...Comment #9
malc0mn commentedAfter some testing, I have confirmed the previously uploaded patch to be applicable and working for 6.15 and for the latest 6.x-dev release. I have no clue why it would fail, so I have reattached it and renamed it to *.d6_15.* just to be sure.
This patch is NOT needed for D7, since this way:
of displaying a search box is no longer possible... At least as far as I can tell and was able to test... The theme functions in the search.module for the search_box have been depricated in favour of overriding the *.tpl.php files for the search box (which is great).
IMHO, it is a vital patch for the D6 branch, since people do use the above mentioned way of displaying a search box (See also: http://drupal.org/node/668016#comment-2665342).
Comment #11
geerlingguy commentedBack to dev... requesting re-test.
[fyi, you need to make the patch against Drupal 6 HEAD].
Comment #12
geerlingguy commented#9: search_404_non_block_fix.d6_15.patch queued for re-testing.
Comment #13
malc0mn commented@11: that was it!!
New patch attached.
Comment #14
malc0mn commented#@!joilm, I'm mixing up my HEADs... Used the correct HEAD now, patch in attach...
Comment #15
malc0mn commentedMade the same mistake here as elswhere, @#!K (forgot -up options when diffing). I just might need some extra sleep. Proper patch in attach...
Comment #16
pwolanin commentedSee note above from Gabor - this cannot be the correct fix since it causes other problems.
Comment #17
malc0mn commented@16: as I mentioned in #8, I have read the thread that introduced the lines I now propose to remove.
They were introduced in both the drupal_not_found() and drupal_access_denied() functions in includes/common.inc. Note that I'm only removing these lines from the drupal_not_found() function. As far as I can see and have tested, these lines are really not needed for 404 pages (where you have a non existing URL in q), they are needed for the 403 pages (where you have an existing URL in q).
The search form works differently than the login form (it needs to always redirect to /search/node/<searchterm> and giving it a destination simply messed that up). The lines introduced in drupal_not_found():
are counteracted by the lines introduced in the search.module:
So, this patch makes drupal_not_found() set a static destination, whereas the exact same patch for search.module says:
This was probably done for a login-redirect on a 404 page, but well... Redirecting back to a 404 would never make sense, right.
I can still be wrong of course, all comments are welcome ;-)
Again, as explained in the initial issue description, confirmed to be working after this patch in D6:
- search on 404 for BLOCK
- search on 404 for $search_box
- login on 403 (by setting up to redirect to /user on a 403 error in /admin/settings/error-reporting)
I will retest this and report back in a next comment. Feel free to do the same, so that we can confirm or deny the correctness of this patch.
If I'm wrong, I'm wrong :-)
Comment #18
malc0mn commentedConfirmed not working with this patch:
- search on 403 using
Halfway there...
Comment #19
traviscarden commentedsubscribing