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.
Whoops....
This is normal, internal URL:
/drupal7x/node/1
This is alias URL
/drupal7x/test
according to url function, alias is set to FASLE by default, BUT:
(dpm output)
url('node/1') => /drupal7x/test
url('node/1', array('alias' => TRUE)) => /drupal7x/node/1
url('test') => /drupal7x/test
url('test', array('alias' => TRUE)) => /drupal7x/test
Looking back in history:
D5 return TRUE
D6 return TRUE
D7 return TRUE
Core Usages of url [590 occurrentces], seems like it may affect a lot of place and modules.. hope im wrong..
Attached 2 patch, one is fixing the bug, 2nd is turn into TRUE by default.
Comment | File | Size | Author |
---|---|---|---|
#1 | url_set_to_TRUE.patch | 1.53 KB | droplet |
url_set_to_TRUE.patch | 1.09 KB | droplet | |
url_fix.patch | 610 bytes | droplet | |
Comments
Comment #1
droplet CreditAttribution: droplet commentedIt's the right patch for set alias to TRUE by default.
url_fix.patch:
url_set_to_TRUE.patch:
Comment #2
nod_No, read the doc it's the proper behavior.
alias mean "the path I'm putting in the first parameter is already an alias, don't look for one" not the opposite.
alias = TRUE means that no change will be made to the path you provide.
Comment #3
droplet CreditAttribution: droplet commenteddamn. I get it now.. I haven't read $path doc before...
Alias = TRUE, avoid an alias look up.
bad design and naming. other parameters, eg. absolute = TRUE, returns absolute URL.
can we move following to alias parameter
and rename it to a better name ?
Comment #4
droplet CreditAttribution: droplet commentedComment #5
nod_well you'd have to rename absolute to is_absolute then is_external and is_https. I don't think that'd be clearer and would break so much stuff it's depressing :þ
Comment #6
droplet CreditAttribution: droplet commentedIt's good if that renamed all, hehe.
But I think it's a bit different
absolute TRUE
node/1 => exmpale.com/node/1
https TURE
enforce to https://xxxxxxxxxxxxx
external TRUE
return external URL
alias TRUE
node/1 => node/1
Comment #7
swentel CreditAttribution: swentel commentedLet's also move it outside the bug queue
Comment #20
smustgrave CreditAttribution: smustgrave at Mobomo commentedWonder if this is still needed for D10?
Comment #21
apadernoThe
\Drupal\Core\Url
class does not use that option anymore.Url::fromUri()
lists the following keys for the$options
array.Even the url_generator service does not seem to use alias.
Comment #22
smustgrave CreditAttribution: smustgrave at Mobomo commentedThink it’s safe to close out then. If anyone disagrees please reopen updating issue summary.
Thanks!