Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
On issue pages (i.e. http://drupal.org/project/issues/user) there are two buttons labelled "Search". One for issues, the other in the upper right corner. If you type something in the upper right corner, it then performs an issue search, and not a site-wide search as one would expect.
Comment | File | Size | Author |
---|---|---|---|
#13 | project_issue-sitewide_search_and_login.patch_1.txt | 820 bytes | dww |
#10 | project_issue-sitewide_search_and_login.patch.txt | 638 bytes | dww |
#6 | sitewide.search.patch.txt | 1.3 KB | Anonymous (not verified) |
Comments
Comment #1
Zen CreditAttribution: Zen commentedI don't know anything about the project module. But the likely issue is that the project module's search form on the issue page hasn't been converted to FAPI. It probably checks $_POST for a certain variable and hijacks the page.
Converting it to FAPI and giving it a unique form ID should fix the issue.
Cheers
-K
Comment #2
Zen CreditAttribution: Zen commented.
Comment #3
dwwthis bug is easily reproducable on a 4.7 test site, so it's got nothing to do with drupal.org or the bluebeach theme. something's just broken in issue.inc. therefore, i'm glad zen/gatsby just moved this to project's issue queue (via discussion on IRC). also, i think this is critical for project to fix, since it makes drupal.org look bad. :(
on a hunch that this was caused by FAPI badness in project and the two buttons labeled "search" clobbering each other, i tried renaming the issue-specific search buttons to "search issues". alas, that didn't solve the problem, either. guess we should do what zen just said about making this a real form with a unique id...
Comment #4
dwwmore descriptive title to help people find this issue more easily
Comment #5
dwwComment #6
Anonymous (not verified) CreditAttribution: Anonymous commentedlooking through the code in project_issue_query_parse() in issue.inc, and it looks like this line is the culprit:
i couldn't figure out why the code does that (quiet possibly because of the champagne), so here's a patch that bails out of the function unless $_POST['edit']['form_id'] is set and it looks like its from a project_issue form.
this seems to fix the site wide search issues.
(and no, i don't need a reason to drink champagne, i just like it...)
Comment #7
dwwi'll take a look when i have some time (today's not good, probably monday). thanks for the investigation!
Comment #8
dwwa) on a test site, i can't seem to reproduce the search bug, though i know it's there. the specific problems on d.o might be b/c the search bar is handled differently in the code than the usual search form boxes from either the search block or the search box handled by the theme...
b) i know a related bug is that if you give anonymous users permission to view issues, and goto the /project/issue page as an anonymous user, you can't login.
so, i think your patch is working, since when the patch is applied, and i try to login on the /project/issue page, it gets a lot further than it used to. however, it hits a code path that's been broken in the code for a while, and you end up trying to do an invalid SQL query. :(
basically, the code currently relies on the fact that project_issue_query_result() will have something in the $query. in project_issue_query_parse(), if $query is going to be empty, we add the default issue states. your patch changes this, and we end up with a NULL query, which leads to the bogus, broken query from ~line 1203 (in your patched version).
that's really a separate bug, but it's related to what you're doing here. namely, your patch, while probably a good move (i wish i knew why it was clearing POST edit and op like that), is exposing a new code path that never used to be hit. we should fix this other problem, regardless. once that's done, we can revisit this patch.
so, this issue is hereby postponed until http://drupal.org/node/77710 is resolved (patch is there, just needs review).
Comment #9
dwwok, that other patch is now committed. this is back in play. however, the wisdom i discovered needs to be put into practice in this patch. you can't just return from project_issue_query_parse() without doing anything, or all hell breaks loose.
i'm just going to investigate ripping out that crazy unset() call completely. it was added here:
i'm guessing it was for the "tablesort loosing search values" mojo. i'm guessing enough has changed since 2003 that this is no longer a problem. initial testing after removing the unset completely seems to work fine. well, actually, it seems that the unset() isn't helping for the tablesort stuff. if you select some custom values in the query via the form elements, and then use the tablesort (e.g. click on a given column in the table to sort by a different value), then the query gets lost, anyway, and you end up with the wrong behavior. ;) just submitted this as http://drupal.org/node/77730 *sigh*
Comment #10
dwwaside from the fact that http://drupal.org/node/77730 is broken (independently of this, it seems), i offer the following as a solution to the site-wide search and anonymous login problem. light testing seems to indicate that a) login now works and b) nothing that currently works stops working using the issue query forms. this seems a lot cleaner than the conditional return, and allows project_issue_query_parse() to continue doing its job of populating $query with something valid.
needs more testing. i was trying to get chx to help me try to understand why the unset() was there in the first place. if that ever happens, i'll certainly report back here.
Comment #11
dwwComment #12
Anonymous (not verified) CreditAttribution: Anonymous commentedtested with the patch that removes the unset(), and it fixes sitewide search, and nothing else seems to be broken.
now, to try to find out what the unset() is for...
Comment #13
dwwchx believes (and i tend to agree) that all the messing around with $_POST in project_issue_query_parse() is, to quote chx: "a remnant of distant past age". ;) here's a new patch that goes 1 step further to remove all such $_POST-munging mojo. further testing seems to indicate this doesn't break anything. i'm inclined to apply it. any last objections/complaints?
Comment #14
Anonymous (not verified) CreditAttribution: Anonymous commentedtested on a fresh install, and the search works.
submitting new issues and searching for issues also still (sic) works.
setting to RTBC
Comment #15
dwwapplied to HEAD, 4.7 and 4.6.
woo hoo! ;) thanks to everyone who helped out with killing this bug...
Comment #16
(not verified) CreditAttribution: commented