Problem/Motivation
Follow up for #2575869-69: Remove all remaining usage of deprecated UrlGeneratorInterface::generateFromPath() and delete it point 3.
+++ b/core/lib/Drupal/Core/Utility/UnroutedUrlAssembler.php
@@ -115,11 +115,6 @@ protected function buildLocalUrl($uri, array $options = [], $collect_bubbleable_
- // Strip leading slashes from internal paths to prevent them becoming
- // external URLs without protocol. /example.com should not be turned into
- // //example.com.
- $uri = ltrim($uri, '/');
@@ -128,6 +123,10 @@ protected function buildLocalUrl($uri, array $options = [], $collect_bubbleable_
+ // Strip leading slashes from internal paths to prevent them becoming
+ // external URLs without protocol. /example.com should not be turned into
+ // //example.com.
+ $uri = ltrim($uri, '/');
@xjm:
I didn't know why this hunk was being moved. @pwolanin said it's because the path processor requires the leading slash, and so this is fixing a bug. Normally I'd suggest fixing said bug first in a separate issue, but given the special circumstances, let's file a followup for adding test coverage for said bug.
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
Comments
Comment #2
jeroentComment #3
jeroentComment #4
yesct commentedadding issue summary template to summary (dreditor has a button to paste that in easily), and titling with a first guess at what the issue actually is [edit: cross post], and moving the information about what this is a follow up for (which point in which comment) to the motivation in the summary. also adding quotes around ... the quote, and saying who said it. (plach taught me to do that a while back)
Comment #5
dawehnerI'll give it a try to write a test.
Comment #6
dawehnerThere we go.
Comment #9
dawehnerYeah yeah, I just can't upload files.
Comment #21
smustgrave commentedAll for adding more test coverage.
Rerolled for 9.5
Also removed needs tests tag as this is a test.
Comment #23
smustgrave commentedRerunning for 10.1
Comment #24
catchLooks good. Let's add it.
Comment #26
smustgrave commentedRandom failure for 9.4
Comment #27
catchCommitted 21d40b7 and pushed to 10.1.x. Thanks!
Comment #29
longwave