8000 feature #8967 [HttpFoundation] Request->getRequestFormat should only … · symfony/symfony@8fdb412 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8fdb412

Browse 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

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/Symfony/Component/HttpFoundation/Request.php

Lines 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

Lines 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