#37342 [Opn]: $HTTP_RAW_POST_DATA Undefined without Content-type

From: Date: Sat, 06 May 2006 22:49:20 +0000
Subject: #37342 [Opn]: $HTTP_RAW_POST_DATA Undefined without Content-type
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-96749@lists.php.net to get a copy of this message
ID: 37342 User updated by: jeff at nokrev dot com Reported By: jeff at nokrev dot com Status: Open Bug Type: Streams related PHP Version: 5.1.4 New Comment: Also, this is not being called called by a form. The content- type is not multipart/form-data, so please do not suggest that. Previous Comments: ------------------------------------------------------------------------ [2006-05-06 22:35:31] 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 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=37342&edit=1

« previous php.bugs (#96749) next »