summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/private/AppFramework/Http/Request.php2
-rw-r--r--tests/lib/AppFramework/Http/RequestTest.php5
2 files changed, 6 insertions, 1 deletions
diff --git a/lib/private/AppFramework/Http/Request.php b/lib/private/AppFramework/Http/Request.php
index fd43d468568..3f1e6fd951a 100644
--- a/lib/private/AppFramework/Http/Request.php
+++ b/lib/private/AppFramework/Http/Request.php
@@ -401,6 +401,8 @@ class Request implements \ArrayAccess, \Countable, IRequest {
protected function getContent() {
// If the content can't be parsed into an array then return a stream resource.
if ($this->method === 'PUT'
+ && $this->getHeader('Content-Length') !== 0
+ && $this->getHeader('Content-Length') !== null
&& strpos($this->getHeader('Content-Type'), 'application/x-www-form-urlencoded') === false
&& strpos($this->getHeader('Content-Type'), 'application/json') === false
) {
diff --git a/tests/lib/AppFramework/Http/RequestTest.php b/tests/lib/AppFramework/Http/RequestTest.php
index cc4bbee2d8d..f80bffcb480 100644
--- a/tests/lib/AppFramework/Http/RequestTest.php
+++ b/tests/lib/AppFramework/Http/RequestTest.php
@@ -305,7 +305,10 @@ class RequestTest extends \Test\TestCase {
$vars = array(
'put' => $data,
'method' => 'PUT',
- 'server' => array('CONTENT_TYPE' => 'image/png'),
+ 'server' => [
+ 'CONTENT_TYPE' => 'image/png',
+ 'CONTENT_LENGTH' => strlen($data)
+ ],
);
$request = new Request(