Skip to content

Commit 0625c2a

Browse files
bug symfony#39550 [HttpFoundation] keep turning dots to underscores when using Request::create() (nicolas-grekas)
This PR was merged into the 5.2 branch. Discussion ---------- [HttpFoundation] keep turning dots to underscores when using Request::create() | Q | A | ------------- | --- | Branch? | 5.2 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix symfony#39546 | License | MIT | Doc PR | - Commits ------- cda81cc [HttpFoundation] keep turning dots to underscores when using Request::create()
2 parents fc160a1 + cda81cc commit 0625c2a

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/Symfony/Component/HttpFoundation/Request.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ public static function create(string $uri, string $method = 'GET', array $parame
405405

406406
$queryString = '';
407407
if (isset($components['query'])) {
408-
$qs = HeaderUtils::parseQuery(html_entity_decode($components['query']));
408+
parse_str(html_entity_decode($components['query']), $qs);
409409

410410
if ($query) {
411411
$query = array_replace($qs, $query);

src/Symfony/Component/HttpFoundation/Tests/RequestTest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,13 +123,14 @@ public function testCreate()
123123
$this->assertEquals('test.com', $request->getHttpHost());
124124
$this->assertFalse($request->isSecure());
125125

126-
$request = Request::create('https://test.com/foo?bar=baz');
127-
$this->assertEquals('https://test.com/foo?bar=baz', $request->getUri());
126+
$request = Request::create('https://test.com/foo?foo.bar=baz');
127+
$this->assertEquals('https://test.com/foo?foo.bar=baz', $request->getUri());
128128
$this->assertEquals('/foo', $request->getPathInfo());
129-
$this->assertEquals('bar=baz', $request->getQueryString());
129+
$this->assertEquals('foo.bar=baz', $request->getQueryString());
130130
$this->assertEquals(443, $request->getPort());
131131
$this->assertEquals('test.com', $request->getHttpHost());
132132
$this->assertTrue($request->isSecure());
133+
$this->assertSame(['foo_bar' => 'baz'], $request->query->all());
133134

134135
$request = Request::create('test.com:90/foo');
135136
$this->assertEquals('http://test.com:90/foo', $request->getUri());

0 commit comments

Comments
 (0)