|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2003-02-20 15:19 UTC] stuart at gnqs dot org
Hi, Just been looking at the XML-RPC classes in PEAR. Granted, I haven't tried running the code, but from inspection it appears to rely on $HTTP_RAW_POST_DATA. That particular variable doesn't exist if register_globals is set to 'off'. The php://input stream has been around since PHP 3.x (according to the manual), and might be a more portable way of handling this. Just tested this under PHP 4.3.0 with register_globals off, and (as expected) it worked fine. Do any other classes in PEAR rely on $HTTP_RAW_POST_DATA? Best regards, Stu -- PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 01:00:01 2025 UTC |
According to bertrand, here is a patch for that. I need feedback from the maintainer before commiting it. Index: Server.php =================================================================== RCS file: /repository/pear/XML_RPC/Server.php,v retrieving revision 1.2 diff -u -u -r1.2 Server.php --- Server.php 28 Feb 2002 10:59:30 -0000 1.2 +++ Server.php 31 Jul 2003 08:52:13 -0000 @@ -221,8 +221,13 @@ global $XML_RPC_err, $XML_RPC_str, $XML_RPC_errxml, $XML_RPC_defencoding, $XML_RPC_Server_dmap; - if ($data=="") { - $data=$HTTP_RAW_POST_DATA; + if (isset($HTTP_RAW_POST_DATA)) { + $input = $HTTP_RAW_POST_DATA; + } else { + $input = implode("\r\n", file('php://input')); + } + if (empty($data)) { + $data = $input; } $parser = xml_parser_create($XML_RPC_defencoding); @@ -301,9 +306,13 @@ // a debugging routine: just echos back the input // packet as a string value - + if (isset($HTTP_RAW_POST_DATA)) { + $input = $HTTP_RAW_POST_DATA; + } else { + $input = implode("\r\n", file('php://input')); + } $r=new XML_RPC_Response; - $r->xv=new XML_RPC_Value( "'Aha said I: '" . $HTTP_RAW_POST_DATA, "string"); + $r->xv=new XML_RPC_Value( "'Aha said I: '" . $input, "string"); print $r->serialize(); } }