|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #37342 $HTTP_RAW_POST_DATA Undefined without Content-type
Submitted: 2006-05-06 22:35 UTC Modified: 2006-05-15 01:00 UTC
Avg. Score:4.0 ± 0.8
Reproduced:1 of 3 (33.3%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: jeff at nokrev dot com Assigned: iliaa (profile)
Status: No Feedback Package: Streams related
PHP Version: 5.1.4 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: jeff at nokrev dot com
New email:
PHP Version: OS:


 [2006-05-06 22:35 UTC] jeff at nokrev dot com
When making a PHP request, if the Content-type request header 
is undefined, $HTTP_RAW_POST_DATA is empty (or undefined, 
depending on the related ini setting).

Reading from the input stream works correctly, and will read 
all content if the content-type is set or not.

Reproduce code:


// Request method
echo "Request Method: ".$_SERVER['REQUEST_METHOD']."\n";


// Input socket
$inputSocket = fopen('php://input','rb');
$contents = stream_get_contents($inputSocket);

echo "Input socket: ".$contents."\n";


Expected result:
When Content-type request header not sent:

Request Method: POST
Input socket: post_contents

Actual result:
It should be the same as if reading from the input stream:

Request Method: POST
HTTP_RAW_POST_DATA: post_contents
Input socket: post_contents


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-05-06 22:49 UTC] jeff at nokrev dot com
Also, this is not being called called by a form. The content-
type is not multipart/form-data, so please do not suggest 
 [2006-05-07 16:17 UTC]
What SAPI are you using, I've just tried it with CVS version 
(which at this time is identical to 5.1.4) and both php://
input and $HTTP_RAW_POST_DATA have the data.
Is the INI setting for capturing RAW_POST_DATA enabled?
 [2006-05-15 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 22:01:28 2024 UTC