Skip to content

Commit 7115c1e

Browse files
pvandommelenfabpot
authored andcommitted
[HttpFoundation] Request->getRequestFormat should only rely on the request attributes
1 parent f4c1a3a commit 7115c1e

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
@@ -1218,7 +1218,7 @@ public function setFormat($format, $mimeTypes)
12181218
public function getRequestFormat($default = 'html')
12191219
{
12201220
if (null === $this->format) {
1221-
$this->format = $this->get('_format', $default);
1221+
$this->format = $this->attributes->get('_format', $default);
12221222
}
12231223

12241224
return $this->format;

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1188,6 +1188,9 @@ public function testGetRequestFormat()
11881188
$request = new Request();
11891189
$this->assertNull($request->setRequestFormat('foo'));
11901190
$this->assertEquals('foo', $request->getRequestFormat(null));
1191+
1192+
$request = new Request(array('_format' => 'foo'));
1193+
$this->assertEquals('html', $request->getRequestFormat());
11911194
}
11921195

11931196
public function testHasSession()

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