Closed (fixed)
Project:
Drupal core
Version:
7.x-dev
Component:
base system
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
28 Dec 2010 at 19:57 UTC
Updated:
26 Apr 2011 at 17:41 UTC
When used to build the path to a Drupal file (like any of the *.php at the install root) instead of menu-generated URL, the url being generated by url() is incorrect if clean urls are off.
It can be worked around using 'script' in the $options array like url('<front>', array('script' => 'xmlrpc.php', 'absolute' => TRUE));, but this feels like a kludge, and definitely less clean than just url('xmlrpc.php', array('absolute' => TRUE)), especially since the latter works (if by chance) when clean urls are on.
Maybe this was unavoidable for performance reasons, but I could not find the issue discussing it.
Comments
Comment #1
robloachTry out....
Comment #2
dave reidYou shouldn't use URL for those.
Comment #3
dave reid@Rob Loach: That will still fail if clean URLs are disabled.
Comment #4
fgm@Dave Reid: was this ever discussed anywhere ?
- By directly using a PHP superglobal, we are missing on the possibility of using an alterator to override the use of such a file.
- More generally, "user" (non-core) code does not normally use plain PHP globals anyway but uses the API. Do we really want to break the pattern ?
I really asked myself this question when noticing use of a construct similar to #2 in existing contrib code. Unless there was a discussion I did not find where this was agreed upon, I do not feel this can really be considered fixed yet.
Or maybe it should be redefined not as a D7 bug but a D8 feature ?
Comment #5
dave reidWe use this way in core to provide links to cron.php and update.php, so I'm not sure what exactly the 'bug' is since contrib can always follow the example set by core. We can create a feature request to possibly make an API function, but I don't really see too much of a need for it.
Comment #6
heine commentedThere's no bug here.
$path The internal path or external URL being linked to, such as "node/34" or "http://example.com/foo"
cron.php is not a 'path'.
Comment #7
dave reid