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.
We asumme the $_SERVER[REQUEST_URI] would contain only the url from the point of Drupal's directory on. This is true only iff you run from the root of your site. If you are in a subdir, the function request_uri() will be unusable if we want to construct a valid url from $base_url and request_uri() (what we do in a number of places). The attached patch fixes this by using basename().
Comment | File | Size | Author |
---|---|---|---|
#7 | request_uri.broken.if.in.subdir.patch | 2.6 KB | Robin Monks |
#4 | request_0.patch | 2.46 KB | killes@www.drop.org |
#2 | request.patch | 761 bytes | killes@www.drop.org |
requi.patch | 678 bytes | killes@www.drop.org | |
Comments
Comment #1
killes@www.drop.org CreditAttribution: killes@www.drop.org commentedThe patch doesn't suffice if your access only the base_url of your Drupal site in a subdir. Putting on hold.
Comment #2
killes@www.drop.org CreditAttribution: killes@www.drop.org commentedok, I think I got it. The distinction between apache and non-apache servers went away to keep it simple.
Comment #3
killes@www.drop.org CreditAttribution: killes@www.drop.org commentedApparently the action in forms depends on the bug that I found, ie it needs request_uri to contain the full url (from documentroot on).
Comment #4
killes@www.drop.org CreditAttribution: killes@www.drop.org commentedThis new patch fixes the problem with forms. request_uri() also does not start with a leading slash anymore. Ask Steven for why this is good. http://acko.net/dumpx/relative.html is apparently a clue I don't get.
Comment #5
Steven CreditAttribution: Steven commentedExplanation:
People are going to stick relative_uri() into links. These links are resolved relative to the $base_url which is put into the <head> tag. However, if a link URI starts with a / then it is relative to the root of the site, even if the base tag uses a path with a subdirectory.
Example:
The first link resolves to http://www.test.com/subdir2, the second resolves to http://www.test.com/subdir1/subdir2.
Thus, it is more meaningful to not have a leading slash, as this will avoid possible bugs with subdirs (which often do not get caught because the tester uses a site without a subdir) and hints at the callee that this is a relative URI too.
Comment #6
Chris Johnson CreditAttribution: Chris Johnson commentedPatch no longer applies completely to bootstrap.inc:
Comment #7
Robin Monks CreditAttribution: Robin Monks commentedHere is that patch re-rolled for latest CVS HEAD.
Since killes hasn't been active in this bug lately, I hope he won't mind my reassigning this to myself.
Robin
Comment #8
Robin Monks CreditAttribution: Robin Monks commentedI've also tested this to work on CVS HEAD.
Robin
Comment #9
moshe weitzman CreditAttribution: moshe weitzman commenteddid you test this on non apache servers? the comment that you removed is crystal clear about a need for 2 different cases. it is OK to 'make it simpler' as long as you don't remove compatibility with other web servers. I am primarily concerned with IIS.
Comment #10
Robin Monks CreditAttribution: Robin Monks commentedI took great care to ensure I didn't remove any support needed for other servers. I also tested this patch to work on Xitami on Win32.
Robin
Comment #11
Robin Monks CreditAttribution: Robin Monks commentedI spent some more time testing, and this broke some (perhaps all) configuration forms. It appears the / is needed after all. Perhaps killes will have better luck understanding this, the / is needed IMHO.
Robin
Comment #12
killes@www.drop.org CreditAttribution: killes@www.drop.org commentedAnother manifestation of this bug:
http://drupal.org/node/26163
Comment #13
killes@www.drop.org CreditAttribution: killes@www.drop.org commentedAnother occurrence:
http://drupal.org/node/20555
Comment #14
Robin Monks CreditAttribution: Robin Monks commentedI'm removing myself from this bug, as I can't adequately understand it to make a quality patch.
Robin
Comment #15
pfaocleCausing problems elsewhere?
Comment #16
pfaocleWhere'd my link go?
Comment #17
killes@www.drop.org CreditAttribution: killes@www.drop.org commentedrelated to this, looks as if it would get fixed there.
http://drupal.org/node/45064