php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #41300 Raw POST data lost, e.g. in XML-RPC communication
Submitted: 2007-05-06 07:31 UTC Modified: 2007-05-06 08:48 UTC
From: dirk at haun-online dot de Assigned:
Status: Not a bug Package: Unknown/Other Function
PHP Version: 5.2.2 OS: all
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git 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.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: dirk at haun-online dot de
New email:
PHP Version: OS:

 

 [2007-05-06 07:31 UTC] 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---

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-05-06 08:41 UTC] johannes@php.net
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.
 [2007-05-06 08:48 UTC] dirk at haun-online dot de
FWIW, I did a search before submitting the bug report but that other bug did not come up ...
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat May 18 13:01:32 2024 UTC