PHP Bugs  
php.net | support | documentation | report a bug | advanced search | search howto | statistics | login

go to bug id or search bugs for  

Bug #37342 $HTTP_RAW_POST_DATA Undefined without Content-type
Submitted:6 May 2006 10:35pm UTC Modified: 15 May 2006 1:00am UTC
From:jeff at nokrev dot com Assigned to:iliaa
Status:No Feedback Category:Streams related
Version:5.1.4 OS:
Votes:2 Avg. Score:4.0 ± 1.0 Reproduced:1 of 2 (50.0%)
Same Version:0 (0.0%) Same OS:0 (0.0%)
View/Vote Add Comment Developer Edit Submission

Welcome! If you don't have a SVN 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.
SVN Username: SVN Password:
Quick Fix:
Status: Assign to:
Category:
Summary:
From: jeff at nokrev dot com
New email:
Version: OS:
New/Additional Comment:

[6 May 2006 10:35pm 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
[6 May 2006 10:49pm 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.
[7 May 2006 4:17pm 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?
[15 May 2006 1:00am 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".

RSS feed | show source 

PHP Copyright © 2001-2009 The PHP Group
All rights reserved.
Last updated: Sat Nov 21 10:30:49 2009 UTC