Skip to content

Commit 66095a5

Browse files
Fix populating server params from URI in HttpFoundationFactory
1 parent cffb3a8 commit 66095a5

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

Factory/HttpFoundationFactory.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,18 @@ public function createRequest(ServerRequestInterface $psrRequest, bool $streamed
5353
$server['REQUEST_URI'] = $uri->getPath();
5454
$server['QUERY_STRING'] = $uri->getQuery();
5555

56+
if ('' !== $server['QUERY_STRING']) {
57+
$server['REQUEST_URI'] .= '?'.$server['QUERY_STRING'];
58+
}
59+
5660
if ('https' === $uri->getScheme()) {
5761
$server['HTTPS'] = 'on';
5862
}
5963
}
6064

6165
$server['REQUEST_METHOD'] = $psrRequest->getMethod();
6266

63-
$server = array_replace($server, $psrRequest->getServerParams());
67+
$server = array_replace($psrRequest->getServerParams(), $server);
6468

6569
$parsedBody = $psrRequest->getParsedBody();
6670
$parsedBody = \is_array($parsedBody) ? $parsedBody : [];

Tests/Functional/CovertTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,8 @@ public function requestProvider()
133133
'SERVER_NAME' => 'dunglas.fr',
134134
'SERVER_PORT' => null,
135135
'HTTP_X_SYMFONY' => '2.8',
136-
'REQUEST_URI' => '/testCreateRequest?bar[baz]=42&foo=1',
137-
'QUERY_STRING' => 'foo=1&bar[baz]=42',
136+
'REQUEST_URI' => '/testCreateRequest?foo=1&bar%5Bbaz%5D=42',
137+
'QUERY_STRING' => 'foo=1&bar%5Bbaz%5D=42',
138138
],
139139
'Content'
140140
);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy