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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: jeff at nokrev dot com
New email:
PHP Version: OS:

 

 [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

Pull Requests

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: Sun Dec 22 01:01:30 2024 UTC