#41300 [NEW]: Raw POST data lost, e.g. in XML-RPC communication

From: Date: Sun, 06 May 2007 07:31:41 +0000
Subject: #41300 [NEW]: Raw POST data lost, e.g. in XML-RPC communication
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-112302@lists.php.net to get a copy of this message
From: dirk at haun-online dot de Operating system: all PHP version: 5.2.2 PHP Bug Type: Unknown/Other Function Bug description: Raw POST data lost, e.g. in XML-RPC communication Description: ------------ Background: The Pingback option in Geeklog 1.4.1 stops working on PHP 5.2.2. Pingbacks are implemented using PEAR::XML_RPC and it appears that the raw POST data is not getting through. In other words, and as demonstrated below, raw POST data is not available through the $HTTP_RAW_POST_DATA or $GLOBALS ['HTTP_RAW_POST_DATA'] variables, independent of the setting of always_populate_raw_post_data in php.ini. Raw POST data is available through php://input, though. Switching back to PHP 5.2.1 resolves the problem. The problem also does not occur with PHP 4.4.7. I'll provide two scripts, send.php and receive.php, below to reproduce the problem. send.php will send an XML-RPC call to receive.php which would normally display the XML data. They should be located on the same server (running PHP 5.2.2), in the server's webroot, i.e. www.example.com/send.php and www.example.com/receive.php. To reproduce, simply call up send.php. This issue has also been reported on php.internals: http://news.php.net/php.internals/29103 and http://news.php.net/php.internals/29202 ff. Reproduce code: --------------- send.php: <?php require_once 'XML/RPC.php'; $sourceURI = 'http://www.example.com/'; // doesn't matter here $targetURI = $sourceURI; $client = new XML_RPC_Client('/receive.php', $_SERVER['HTTP_HOST']); $client->setDebug(1); $msg = new XML_RPC_Message('pingback.ping', array(new XML_RPC_Value($sourceURI, 'string'), new XML_RPC_Value($targetURI, 'string'))); $response = $client->send($msg, 0, 'http'); ?> receive.php: <?php print_r(getallheaders()); echo $GLOBALS['HTTP_RAW_POST_DATA'] . "\n\n"; ?> Expected result: ---------------- ---GOT--- HTTP/1.1 200 OK Date: Sat, 05 May 2007 08:01:49 GMT Server: Apache/1.3.37 (Unix) PHP/5.2.2 X-Powered-By: PHP/5.2.2 Connection: close Content-Type: text/html <?xml version="1.0" encoding="UTF-8"?> <methodCall> <methodName>pingback.ping</methodName> <params> <param> <value><string>http://www.example.com/</string></value> </param> <param> <value><string>http://www.example.com/</string></value> </param> </params> </methodCall> ---END--- Actual result: -------------- ---GOT--- HTTP/1.1 200 OK Date: Fri, 04 May 2007 20:07:58 GMT Server: Apache/1.3.37 (Unix) PHP/5.2.2 X-Powered-By: PHP/5.2.2 Connection: close Content-Type: text/html Array ( [Content-Length] => 282 [Content-Type] => text/xml [Host] => myhost.example.com [User-Agent] => PEAR XML_RPC ) <br /> <b>Notice</b>: Undefined index: HTTP_RAW_POST_DATA in <b>/usr/local/ apache/vhost/geeklog/public_html/receive.php</b> on line <b>5</b><br / > ---END--- -- Edit bug report at http://bugs.php.net/?id=41300&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=41300&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=41300&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=41300&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=41300&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=41300&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=41300&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=41300&r=needscript Try newer version: http://bugs.php.net/fix.php?id=41300&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=41300&r=support Expected behavior: http://bugs.php.net/fix.php?id=41300&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=41300&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=41300&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=41300&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=41300&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=41300&r=dst IIS Stability: http://bugs.php.net/fix.php?id=41300&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=41300&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=41300&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=41300&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=41300&r=mysqlcfg

« previous php.bugs (#112302) next »