ID: 22338 Updated by: [EMAIL PROTECTED] Reported By: stuart at gnqs dot org Status: No Feedback Bug Type: *General Issues Operating System: Windows XP PHP Version: 4.3.0 Assigned To: ssb New Comment:
You shouldn't use file/implode to read files, it uses tons of memory and you have better options. In this case any version of php that has php://input has file_get_contents, so just use that. Previous Comments: ------------------------------------------------------------------------ [2006-03-12 10:40:33] ifyoumind at yahoo dot com Hi, Am trying to use NUSOAP and it requires HTTP_RAW_POST_DATA variable set. I have both the register_globals and always_populate_raw_post_data on but still it gives me an error HTTP_RAW_POST_DATA. I read quiet a lot of forum where almost in all places the question is clear and the answer still is murky. It doesn't make any sense when always_populate_raw_post_data turned on when I echo $HTTP_RAW_POST_DATA it actually gives me an error! ------------------------------------------------------------------------ [2005-05-24 01:00:04] pear-dev at lists dot php dot net No feedback was provided for this bug for over a week, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open". ------------------------------------------------------------------------ [2005-05-16 12:08:19] [EMAIL PROTECTED] Please try using this CVS snapshot: http://snaps.php.net/php4-STABLE-latest.tar.gz For Windows: http://snaps.php.net/win32/php4-win32-STABLE-latest.zip ------------------------------------------------------------------------ [2003-07-31 03:52:59] [EMAIL PROTECTED] 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(); } } ------------------------------------------------------------------------ [2003-04-27 09:55:17] [EMAIL PROTECTED] This is not affected by register_globals and if it is then that's a bug in itself, it would have been a very recent change and a BC issue. Are you saying it's defined with register_globals on and undefined when off, with this being the ONLY change?!! I sincerly hope this isn't the case although if register_globals decides to register it even when no value exists that wouldn't be a _major_ deal, just silly. Regarding php://input, this also has issues as AFAICT it didn't work for this with CGI before PHP 4.3.0. The existence of this raw post information is pretty sketchy in PHP, I don't envy anyone writing scripts that rely on it. Here's a quote from Hartmut who was working on fixing it (quoted from the above thread): "from now on i declare it best practice to use php://input for 4.3 while $HTTP_RAW_POST_DATA is still available for BC reasons ... :)" And lastly, the existence of this variable shouldn't rely on any directive as it's creation can be forced (bad mime...). That always populate directive just makes it easier to deal with. In conclusion, I believe a hack is required to check for and find this information in both locations. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/22338 -- Edit this bug report at http://bugs.php.net/?id=22338&edit=1