Closed (won't fix)
Project:
Drupal core
Version:
5.x-dev
Component:
search.module
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
6 Feb 2007 at 11:17 UTC
Updated:
4 Jan 2011 at 16:58 UTC
Jump to comment: Most recent
Comments
Comment #1
traxer commentedConfirmed in Drupal 5.5, regardless of the region the block is in. The search field mentioned on
admin/build/themes/settingsdoes not show faulty behavior.Comment #2
mercmobily commentedHi,
This in intriguing.
I can have a look if nobody else is.
(If somebody is already onto it, I won't replicate the efforts)
Bye,
Merc.
Comment #3
mercmobily commentedHi,
First step...
For any future developer should I fail miserably.
In the "faulty" form, this is never true:
function search_view() {
$type = arg(1);
// Search form submits with POST but redirects to GET. This way we can keep
// the search query URL clean as a whistle:
// search/type/keyword+keyword
if (!isset($_POST['form_id'])) {
/* THE FAULTY FORM WILL NEVER EVER GET HERE*/
I am trying to backtrack the problem, and see WHERE the two forms behave differently code-wise.
Merc.
Comment #4
mercmobily commentedHi,
Update #2:
The "actual" problem is that for the "faulty" form the submit hook is never called. Therefore, redirection doesn't happen at all.
search_form_submit() never happens. I am not familiar with the internals of how the submit hooks is actually called. I might have to "get familiar" right now. However, I don't have much time left.
Merc.
Comment #5
mercmobily commentedHi,
Short update: in form.inc, something's wrong with the faulty form:
function drupal_submit_form($form_id, $form) {
global $form_values;
$default_args = array($form_id, &$form_values);
$submitted = FALSE;
$goto = NULL;
if (isset($form['#submit'])) { <--- This is never true
If course, it ought to be.
Trying to backtrace the problem from here.
Merc.
Comment #6
mercmobily commentedHi,
Alright, this is gonna be "it" as far as my investigation... hopefully somebody with a deeper understanding of how forms work in Drupal will find this info useful.
Basically, when is set, the function drupal_process_form() appears to be called only once. The $form_id is 'search_form', whereas _POST['form_id'] is 'search_block_form' - they are not the same, and therefore this ends up being false:
if (($form['#programmed']) || (!empty($_POST) && (($_POST['form_id'] == $form_id)))) {
HOWEVER, if is not set drupal_process_form() is then called _again_, and this time $form_id is correct: it's 'search_block_form'. Therefore, the if above works and the form is actually processed.
I tried and tried to figure out why on earth drupal_process_form() is called again, but I don't know Drupal forms well enough to figure this out.
I hope this will help...
Merc.
Comment #7
robertdouglass commentedbetter title.
Comment #8
mercmobily commentedHi,
I have the feeling robertDouglass is about to show how little I know about Drupal by fixing this in 11 minutes.
I can only hope my little analysis helps, even a little bit.
Merc.
Comment #9
robertdouglass commented@mercmobily: actually, I'm sorting through all search related issues making sure they have good titles, the right status, and are relevant, so that they get the attention they need. I haven't looked at this one in depth.
Comment #10
Anonymous (not verified) commentedThe problem seems to be that the block and theme search forms rely on re-submitting the form at the search/node path. If the form is disabled on that page, the values won't get passed back to the path so the search can actually be done.
I suspect the reason the theme search form doesn't have this problem is because if you're using the theme search form, you're probably displaying it on every page because it's part of your page.tpl.php.
The easy solution is to use CSS to hide the search form on your search pages. You could either do this by overriding the theme function:
or by using a CSS rule that selects based on a property of the page (see Zen's phptemplate_page function for an example in Drupal 5).
Comment #11
jhodgdonI think the search code is doing the same kind of redirect in Drupal 7, so this could still be an issue? Moving to D7 temporarily at least until someone investigates. If it's not a D7 bug, then we need to see if it's D6. If not that, move back to D5 for fixing.
Comment #12
jhodgdonFollowing the steps given in the original issue report...
a) I just tested this in Drupal 7. It is not a bug there. When you get to the search page, you have your search term (no search block visible) and the search results are there.
b) Same for Drupal 6.
I don't have a Drupal 5 test box set up at the moment, but I'll put this down to Drupal 5.x for testing/verification/fixing.
Comment #13
jhodgdon7.0 is out tomorrow, 5.x is obsolete, won't fix, sorry.