Loading core/lib/Drupal/Core/PathProcessor/PathProcessorFront.php +1 −1 Original line number Diff line number Diff line Loading @@ -46,7 +46,7 @@ public function processInbound($path, Request $request) { // with URL query, so that actual URL takes precedence. if (!empty($components['query'])) { parse_str($components['query'], $parameters); array_replace($parameters, $request->query->all()); $parameters = array_replace($parameters, $request->query->all()); $request->query->replace($parameters); } } Loading core/tests/Drupal/Tests/Core/PathProcessor/PathProcessorFrontTest.php +18 −2 Original line number Diff line number Diff line Loading @@ -27,7 +27,7 @@ class PathProcessorFrontTest extends UnitTestCase { * @legacy-covers ::processInbound */ #[DataProvider('providerProcessInbound')] public function testProcessInbound($frontpage_path, $path, $expected, array $expected_query = []): void { public function testProcessInbound($frontpage_path, $path, $expected, array $expected_query = [], array $request_query = []): void { $config_factory = $this->prophesize(ConfigFactoryInterface::class); $config = $this->prophesize(ImmutableConfig::class); $config_factory->get('system.site') Loading @@ -36,6 +36,7 @@ public function testProcessInbound($frontpage_path, $path, $expected, array $exp ->willReturn($frontpage_path); $processor = new PathProcessorFront($config_factory->reveal()); $request = new Request(); $request->query->replace($request_query); $this->assertEquals($expected, $processor->processInbound($path, $request)); $this->assertEquals($expected_query, $request->query->all()); } Loading @@ -47,11 +48,26 @@ public static function providerProcessInbound() { return [ 'accessing frontpage' => ['/node', '/', '/node'], 'accessing non frontpage' => ['/node', '/user', '/user'], 'accessing frontpage with query parameters' => ['/node?example=muh', 'accessing frontpage with query parameters' => [ '/node?example=muh', '/', '/node', ['example' => 'muh'], ], 'frontpage with query parameters and request query parameters' => [ '/node?example=muh', '/', '/node', ['example' => 'muh', 'example2' => 'buh'], ['example2' => 'buh'], ], 'frontpage with query parameters and replacement request query parameters' => [ '/node?example=muh', '/', '/node', ['example' => 'cuh', 'example2' => 'buh'], ['example' => 'cuh', 'example2' => 'buh'], ], ]; } Loading Loading
core/lib/Drupal/Core/PathProcessor/PathProcessorFront.php +1 −1 Original line number Diff line number Diff line Loading @@ -46,7 +46,7 @@ public function processInbound($path, Request $request) { // with URL query, so that actual URL takes precedence. if (!empty($components['query'])) { parse_str($components['query'], $parameters); array_replace($parameters, $request->query->all()); $parameters = array_replace($parameters, $request->query->all()); $request->query->replace($parameters); } } Loading
core/tests/Drupal/Tests/Core/PathProcessor/PathProcessorFrontTest.php +18 −2 Original line number Diff line number Diff line Loading @@ -27,7 +27,7 @@ class PathProcessorFrontTest extends UnitTestCase { * @legacy-covers ::processInbound */ #[DataProvider('providerProcessInbound')] public function testProcessInbound($frontpage_path, $path, $expected, array $expected_query = []): void { public function testProcessInbound($frontpage_path, $path, $expected, array $expected_query = [], array $request_query = []): void { $config_factory = $this->prophesize(ConfigFactoryInterface::class); $config = $this->prophesize(ImmutableConfig::class); $config_factory->get('system.site') Loading @@ -36,6 +36,7 @@ public function testProcessInbound($frontpage_path, $path, $expected, array $exp ->willReturn($frontpage_path); $processor = new PathProcessorFront($config_factory->reveal()); $request = new Request(); $request->query->replace($request_query); $this->assertEquals($expected, $processor->processInbound($path, $request)); $this->assertEquals($expected_query, $request->query->all()); } Loading @@ -47,11 +48,26 @@ public static function providerProcessInbound() { return [ 'accessing frontpage' => ['/node', '/', '/node'], 'accessing non frontpage' => ['/node', '/user', '/user'], 'accessing frontpage with query parameters' => ['/node?example=muh', 'accessing frontpage with query parameters' => [ '/node?example=muh', '/', '/node', ['example' => 'muh'], ], 'frontpage with query parameters and request query parameters' => [ '/node?example=muh', '/', '/node', ['example' => 'muh', 'example2' => 'buh'], ['example2' => 'buh'], ], 'frontpage with query parameters and replacement request query parameters' => [ '/node?example=muh', '/', '/node', ['example' => 'cuh', 'example2' => 'buh'], ['example' => 'cuh', 'example2' => 'buh'], ], ]; } Loading