diff --git a/core/lib/Drupal/Core/Utility/UnroutedUrlAssembler.php b/core/lib/Drupal/Core/Utility/UnroutedUrlAssembler.php index 2569ee4adbaba186634f2a542674a1cd40806c9e..5e50f5e2b30617633100d69e24f1c5f11e2410de 100644 --- a/core/lib/Drupal/Core/Utility/UnroutedUrlAssembler.php +++ b/core/lib/Drupal/Core/Utility/UnroutedUrlAssembler.php @@ -78,7 +78,6 @@ protected function buildExternalUrl($uri, array $options = [], $collect_bubbleab $options += ['query' => []]; $options['query'] = NestedArray::mergeDeep($parsed['query'], $options['query']); - ksort($options['query']); if ($parsed['fragment'] && !$options['fragment']) { $options['fragment'] = '#' . $parsed['fragment']; diff --git a/core/modules/system/tests/src/Functional/Common/UrlTest.php b/core/modules/system/tests/src/Functional/Common/UrlTest.php index 8e4d7b121c5852a7d7ca65ebf85d2350f7734d9e..362868c3178321f939f803507a9a268ddde73d6e 100644 --- a/core/modules/system/tests/src/Functional/Common/UrlTest.php +++ b/core/modules/system/tests/src/Functional/Common/UrlTest.php @@ -314,7 +314,7 @@ public function testExternalUrls() { $url = $test_url . '?drupal=awesome'; $query = ['awesome' => 'drupal']; $result = Url::fromUri($url, ['query' => $query])->toString(); - $this->assertEqual('https://www.drupal.org/?awesome=drupal&drupal=awesome', $result); + $this->assertEqual('https://www.drupal.org/?drupal=awesome&awesome=drupal', $result); } } diff --git a/core/tests/Drupal/Tests/Core/Utility/UnroutedUrlAssemblerTest.php b/core/tests/Drupal/Tests/Core/Utility/UnroutedUrlAssemblerTest.php index 70b3880f4c1df8c7eebf4d5d3b1a6ddbb48ba34c..0a46582299c8cfdf3c1e4ff7e22bb1a80cc75cb4 100644 --- a/core/tests/Drupal/Tests/Core/Utility/UnroutedUrlAssemblerTest.php +++ b/core/tests/Drupal/Tests/Core/Utility/UnroutedUrlAssemblerTest.php @@ -97,8 +97,8 @@ public function providerTestAssembleWithExternalUrl() { ['https://example.com/test', ['https' => FALSE], 'http://example.com/test'], ['https://example.com/test?foo=1#bar', [], 'https://example.com/test?foo=1#bar'], 'override-query' => ['https://example.com/test?foo=1#bar', ['query' => ['foo' => 2]], 'https://example.com/test?foo=2#bar'], - 'override-query-merge' => ['https://example.com/test?foo=1#bar', ['query' => ['bar' => 2]], 'https://example.com/test?bar=2&foo=1#bar'], - 'override-deep-query-merge' => ['https://example.com/test?foo=1#bar', ['query' => ['bar' => ['baz' => 'foo']]], 'https://example.com/test?bar%5Bbaz%5D=foo&foo=1#bar'], + 'override-query-merge' => ['https://example.com/test?foo=1#bar', ['query' => ['bar' => 2]], 'https://example.com/test?foo=1&bar=2#bar'], + 'override-deep-query-merge' => ['https://example.com/test?foo=1#bar', ['query' => ['bar' => ['baz' => 'foo']]], 'https://example.com/test?foo=1&bar%5Bbaz%5D=foo#bar'], 'override-fragment' => ['https://example.com/test?foo=1#bar', ['fragment' => 'baz'], 'https://example.com/test?foo=1#baz'], ['//www.drupal.org', [], '//www.drupal.org'], ];