php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #41293 HTTP_RAW_POST_DATA fails to ever be set
Submitted: 2007-05-04 19:50 UTC Modified: 2007-05-06 16:34 UTC
Votes:7
Avg. Score:4.9 ± 0.3
Reproduced:7 of 7 (100.0%)
Same Version:6 (85.7%)
Same OS:4 (57.1%)
From: jerome at rainstormconsulting dot com Assigned: iliaa (profile)
Status: Closed Package: HTTP related
PHP Version: 5.2.2 OS: linux (centos or ubuntu)
Private report: No CVE-ID: None
 [2007-05-04 19:50 UTC] jerome at rainstormconsulting dot com
Description:
------------
PHP 5.2.2 fails to ever have $HTTP_RAW_POST_DATA set despite the ini setting to being On

Reproduce code:
---------------
Server:
<?php
$server = new SoapServer('myservice.wsdl');
$server->setClass('MyService');
$server->handle();

client:
<?php
$client = new SoapClient('myservice.wsdl', array('trace' => 1, 'exceptions' => 1));
try {
    $client->doSomething();
}
catch(SoapFault $e) {
    print 'Service failure, error message: '.$e->faultstring;
}

Expected result:
----------------
This should proceed with no problems, an already working service setup in a web application, functioning on both PHP 5.1.6 and PHP 5.2.1 with no issues at all.  Should produce no error.

Actual result:
--------------
Service failure, error message: Bad Request. Can't find HTTP_RAW_POST_DATA

You USUALLY only see this if you access the server file (say xmlrpc.php) directly without posting any data. 

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-05-04 21:13 UTC] sniper@php.net
Only happens with RPC stuff. (soap / xml-rpc /..). 
php://input is not affected.

 [2007-05-05 14:10 UTC] develar at gmail dot com
>> php://input is not affected
only in start script, but in end script php://input is empty.
 [2007-05-06 13:35 UTC] sylvain at jamendo dot com
Are you aware that this is a *major* issue?

All our xmlrpc backends are broken because of this bug, both with pear XML_RPC and XML_RPC2.

Is there a workaround besides php://input ?
 [2007-05-06 13:42 UTC] jerome at rainstormconsulting dot com
Putting this in a file all my services include seems to be working, 
but I only did this on a test machine, i will not upgrade our 
production server until this is resolved though.

if (!isset($HTTP_RAW_POST_DATA)){
    $HTTP_RAW_POST_DATA = file_get_contents('php://input');
}
 [2007-05-06 14:06 UTC] sylvain at jamendo dot com
I used the same fix as Jerome, 

if (phpversion()=="5.2.2") $GLOBALS['HTTP_RAW_POST_DATA'] = file_get_contents("php://input");

Anyway, this seems like a duplicate of a bug that appeared in 5.1.0 (cf changelog)

I just can't believe there is no unit tests for this kind of bugs that should never ever appear again.
 [2007-05-06 16:34 UTC] iliaa@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 [2011-04-12 06:38 UTC] php at yahoo dot com
Thank you all
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 10:01:30 2024 UTC