php.net |  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
Votes:3
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
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
37 + 8 = ?
Subscribe to this entry?

 
 [2006-05-06 22:35 UTC] jeff at nokrev dot com
Description:
------------
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:
---------------
<?php

/* PRINT DEBUG INFO */

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

// HTTP_RAW_POST_DATA
echo "HTTP_RAW_POST_DATA: ".$HTTP_RAW_POST_DATA."\n";

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

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

?>

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

Request Method: POST
HTTP_RAW_POST_DATA: 
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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

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 
that.
 [2006-05-07 16:17 UTC] iliaa@php.net
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: Tue Mar 19 03:01:29 2024 UTC