So, uhm, this is tricky.
Coming from #600392: search_form() has an $action argument but this argument is partially ignored:
With the new HTTPS support, but also in general, anything can turn a path into an absolute URL by calling url().
With clean URLs disabled, we get http://example.com/?q=foo/bar
drupal_parse_url() is supposed to return the proper 'path', 'query', and 'fragment' for a URL, suitable to pass that along to url().
However, above example will get you array('path' => 'http://example.com/', 'query' => array('q' => 'foo/bar'))
instead of 'foo/bar' in 'path'.
The only idea I have to solve this is to check whether clean URLs are disabled, and conditionally overwrite the parsed 'path' in case 'query' contains a 'q'...
ugh.
Comment | File | Size | Author |
---|---|---|---|
#10 | drupal.parse-url-unclean.10.patch | 2.84 KB | sun |
#9 | drupal.parse-url-unclean.9a.patch | 2.84 KB | sun |
#3 | drupal.parse-url-unclean.3.patch | 2.99 KB | sun |
#2 | drupal.parse-url-unclean.2.patch | 1.86 KB | sun |
drupal.parse-url-unclean.patch | 1.08 KB | sun | |
Comments
Comment #2
sunAnd this is the only solution I can think of.
Comment #3
sunI take the blame for not accounting for this situation in the original patch that introduced drupal_parse_url().
Comment #4
webchickI'd like to see someone else eyeball this fix. There are no APIs touched here; it's just a straight-up bug fix, which can happen anytime post-10/15.
Removing tag accordingly.
Comment #5
sunI'm inclined to re-add the tag, because this fix is also required for #582456: Make confirm_form() respect query string destination
Comment #6
webchickI don't understand how that would be the case. It'd just mean confirm forms would be broken for non-clean URLs as well.
Comment #7
sunnah, the issue is that other patch is an API clean-up patch, which currently *cannot* pass tests, because drupal_parse_url() doesn't work correctly without clean URLs, and because the testbot is running without clean URLs. :)
Comment #8
Damien Tournoud CreditAttribution: Damien Tournoud commentedThis makes a lot of sense. I would like to see the check for
q=
being made unconditional, because it's the way it works currently (at least in Apache).Comment #9
sunRemoved the conditional check for clean URLs.
Comment #10
sunSuper-minor test clean-up.
Comment #11
Damien Tournoud CreditAttribution: Damien Tournoud commentedGood. This makes drupal_parse_url() an intelligent, specialized, inverse of url().
Comment #12
webchickThanks. Committed to HEAD!