diff --git a/Factory/HttpFoundationFactory.php b/Factory/HttpFoundationFactory.php index 105dd99..6427a99 100644 --- a/Factory/HttpFoundationFactory.php +++ b/Factory/HttpFoundationFactory.php @@ -53,6 +53,10 @@ public function createRequest(ServerRequestInterface $psrRequest, bool $streamed $server['REQUEST_URI'] = $uri->getPath(); $server['QUERY_STRING'] = $uri->getQuery(); + if ('' !== $server['QUERY_STRING']) { + $server['REQUEST_URI'] .= '?'.$server['QUERY_STRING']; + } + if ('https' === $uri->getScheme()) { $server['HTTPS'] = 'on'; } @@ -60,7 +64,7 @@ public function createRequest(ServerRequestInterface $psrRequest, bool $streamed $server['REQUEST_METHOD'] = $psrRequest->getMethod(); - $server = array_replace($server, $psrRequest->getServerParams()); + $server = array_replace($psrRequest->getServerParams(), $server); $parsedBody = $psrRequest->getParsedBody(); $parsedBody = \is_array($parsedBody) ? $parsedBody : []; diff --git a/Tests/Functional/CovertTest.php b/Tests/Functional/CovertTest.php index 11f86c8..4fc6890 100644 --- a/Tests/Functional/CovertTest.php +++ b/Tests/Functional/CovertTest.php @@ -133,8 +133,8 @@ public function requestProvider() 'SERVER_NAME' => 'dunglas.fr', 'SERVER_PORT' => null, 'HTTP_X_SYMFONY' => '2.8', - 'REQUEST_URI' => '/testCreateRequest?bar[baz]=42&foo=1', - 'QUERY_STRING' => 'foo=1&bar[baz]=42', + 'REQUEST_URI' => '/testCreateRequest?foo=1&bar%5Bbaz%5D=42', + 'QUERY_STRING' => 'foo=1&bar%5Bbaz%5D=42', ], 'Content' );