Commit 9254d841 authored by catch's avatar catch

Issue #3027763 by quietone, LiamPower, pratik_kamble: UnroutedUrlAssembler...

Issue #3027763 by quietone, LiamPower, pratik_kamble: UnroutedUrlAssembler removes query params array item key in buildExternalUrl()

(cherry picked from commit 0c162500850c1e2da56b63d5e6e54e1aba172871)
parent 35d3a84a
......@@ -77,7 +77,7 @@ protected function buildExternalUrl($uri, array $options = [], $collect_bubbleab
$parsed += ['query' => []];
$options += ['query' => []];
$options['query'] = NestedArray::mergeDeep($parsed['query'], $options['query']);
$options['query'] = NestedArray::mergeDeepArray([$parsed['query'], $options['query']], TRUE);
if ($parsed['fragment'] && !$options['fragment']) {
$options['fragment'] = '#' . $parsed['fragment'];
......
......@@ -313,6 +313,11 @@ public function testExternalUrls() {
$result = Url::fromUri($url)->toString();
$this->assertEqual($url, $result);
// Verify external URL can contain a query string with an integer key.
$url = $test_url . '?120=1';
$result = Url::fromUri($url)->toString();
$this->assertEqual($url, $result);
// Verify external URL can be extended with a query string.
$url = $test_url;
$query = ['awesome' => 'drupal'];
......
......@@ -99,6 +99,7 @@ public function providerTestAssembleWithExternalUrl() {
'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?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-deep-query-merge-int-ket' => ['https://example.com/test?120=1', ['query' => ['bar' => ['baz' => 'foo']]], 'https://example.com/test?120=1&bar%5Bbaz%5D=foo'],
'override-fragment' => ['https://example.com/test?foo=1#bar', ['fragment' => 'baz'], 'https://example.com/test?foo=1#baz'],
['//www.drupal.org', [], '//www.drupal.org'],
];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment