diff --git a/src/Symfony/Component/HttpFoundation/Request.php b/src/Symfony/Component/HttpFoundation/Request.php index 125be18bbb..dc32f4a39a 100644 --- a/src/Symfony/Component/HttpFoundation/Request.php +++ b/src/Symfony/Component/HttpFoundation/Request.php @@ -1516,7 +1516,7 @@ class Request 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 8540cad663..f90a368775 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php @@ -1042,8 +1042,16 @@ class RequestTest extends \PHPUnit_Framework_TestCase $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 @@ class RequestTest extends \PHPUnit_Framework_TestCase $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), );