|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #70576 On PUT/PATCH Methods all PHP file methods can read php://input just one time
Submitted: 2015-09-24 20:50 UTC Modified: 2015-09-25 07:28 UTC
From: chameleonbr at gmail dot com Assigned: mike (profile)
Status: Closed Package: Filesystem function related
PHP Version: 5.5.29 OS: OpenSUSE 13.2
Private report: No CVE-ID: None
 [2015-09-24 20:50 UTC] chameleonbr at gmail dot com
On HTTP PUT and PATCH Methods all PHP file methods can read php://input just one time.
In the method post 2 times the value appears as expected, but the put and patch methods returns only one time.

Test script:

Send DATA using HTTP POST and after HTTP PUT or PATCH.

Actual result:
curl -X POST -H "Content-Type: application/x-www-form-urlencoded" -d 'var1=val2&var2=val2' 'http://localhost/testmethod.php'
string(19) "var1=val2&var2=val2"
string(19) "var1=val2&var2=val2"

curl -X PUT -H "Content-Type: application/x-www-form-urlencoded" -d 'var1=val2&var2=val2' 'http://localhost/testmethod.php'

string(19) "var1=val2&var2=val2"
string(0) ""

curl -X PATCH -H "Content-Type: application/x-www-form-urlencoded" -d 'var1=val2&var2=val2' 'http://localhost/testmethod.php'

string(19) "var1=val2&var2=val2"
string(0) ""


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2015-09-24 23:51 UTC]
-Status: Open +Status: Closed -Assigned To: +Assigned To: mike
 [2015-09-24 23:51 UTC]
This was fixed in PHP 5.6.
5.5 is now only receiving security fixes so please consider upgrading.
 [2015-09-25 07:28 UTC]
Also, if you'd like 'application/x-www-form-urlencoded' data to end up in $_POST/$_REQUEST for request methods other than 'POST', have a look at ext-apfd:
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Sun Jun 04 19:03:41 2023 UTC