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

From: Date: Sun, 06 May 2007 08:41:03 +0000
Subject: #41300 [Opn->Bgs]: Raw POST data lost, e.g. in XML-RPC communication
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-112305@lists.php.net to get a copy of this message
ID: 41300 Updated by: johannes@php.net Reported By: dirk at haun-online dot de -Status: Open +Status: Bogus Bug Type: Unknown/Other Function Operating System: all PHP Version: 5.2.2 New Comment: Please do not submit the same bug more than once. An existing bug report already describes this very problem. Even if you feel that your issue is somewhat different, the resolution is likely to be the same. Thank you for your interest in PHP. See also bug #41293. Previous Comments: ------------------------------------------------------------------------ [2007-05-06 07:31:41] dirk at haun-online dot de 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 this bug report at http://bugs.php.net/?id=41300&edit=1

« previous php.bugs (#112305) next »