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.
Comments
Comment #1
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 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 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 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 commentedLet's also move it outside the bug queue
Comment #20
smustgrave commentedWonder if this is still needed for D10?
Comment #21
avpadernoThe
\Drupal\Core\Urlclass does not use that option anymore.Url::fromUri()lists the following keys for the$optionsarray.Even the url_generator service does not seem to use alias.
Comment #22
smustgrave commentedThink it’s safe to close out then. If anyone disagrees please reopen updating issue summary.
Thanks!