Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 8fdb412

Browse filesBrowse files
committed
feature #8967 [HttpFoundation] Request->getRequestFormat should only rely on the request attributes (pvandommelen)
This PR was squashed before being merged into the 3.0-dev branch (closes #8967). Discussion ---------- [HttpFoundation] Request->getRequestFormat should only rely on the request attributes | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | possibly | Deprecations? | no | Tests pass? | yes | Fixed tickets | #8966 | License | MIT | Doc PR | Added test case and fix for #8966. Is this functionality relied on somewhere? Commits ------- 7115c1e [HttpFoundation] Request->getRequestFormat should only rely on the request attributes
2 parents c3bad5a + 7115c1e commit 8fdb412
Copy full SHA for 8fdb412

File tree

2 files changed

+4
-1
lines changed
Filter options

2 files changed

+4
-1
lines changed

‎src/Symfony/Component/HttpFoundation/Request.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpFoundation/Request.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1371,7 +1371,7 @@ public function setFormat($format, $mimeTypes)
13711371
public function getRequestFormat($default = 'html')
13721372
{
13731373
if (null === $this->format) {
1374-
$this->format = $this->get('_format', $default);
1374+
$this->format = $this->attributes->get('_format', $default);
13751375
}
13761376

13771377
return $this->format;

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpFoundation/Tests/RequestTest.php
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1363,6 +1363,9 @@ public function testGetRequestFormat()
13631363
$request = new Request();
13641364
$this->assertNull($request->setRequestFormat('foo'));
13651365
$this->assertEquals('foo', $request->getRequestFormat(null));
1366+
1367+
$request = new Request(array('_format' => 'foo'));
1368+
$this->assertEquals('html', $request->getRequestFormat());
13661369
}
13671370

13681371
public function testHasSession()

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.