diff --git a/src/Symfony/Component/HttpFoundation/Request.php b/src/Symfony/Component/HttpFoundation/Request.php index 125be18bbb409..dc32f4a39af92 100644 --- a/src/Symfony/Component/HttpFoundation/Request.php +++ b/src/Symfony/Component/HttpFoundation/Request.php @@ -1516,7 +1516,7 @@ public function getContent($asResource = false) return stream_get_contents($this->content); } - if (null === $this->content) { + if (null === $this->content || false === $this->content) { $this->content = file_get_contents('php://input'); } diff --git a/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php b/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php index 8540cad6630ee..f90a368775a16 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php @@ -1042,8 +1042,16 @@ public function testGetContentCantBeCalledTwiceWithResources($first, $second) $req->getContent($second); } + public function getContentCantBeCalledTwiceWithResourcesProvider() + { + return array( + 'Resource then fetch' => array(true, false), + 'Resource then resource' => array(true, true), + ); + } + /** - * @dataProvider getContentCantBeCalledTwiceWithResourcesProvider + * @dataProvider getContentCanBeCalledTwiceWithResourcesProvider * @requires PHP 5.6 */ public function testGetContentCanBeCalledTwiceWithResources($first, $second) @@ -1060,12 +1068,14 @@ public function testGetContentCanBeCalledTwiceWithResources($first, $second) $b = stream_get_contents($b); } - $this->assertEquals($a, $b); + $this->assertSame($a, $b); } - public function getContentCantBeCalledTwiceWithResourcesProvider() + public function getContentCanBeCalledTwiceWithResourcesProvider() { return array( + 'Fetch then fetch' => array(false, false), + 'Fetch then resource' => array(false, true), 'Resource then fetch' => array(true, false), 'Resource then resource' => array(true, true), ); 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