Home » Web Services » XML_RPC » Bug #2521
Broken encoding of '\r\n' line-ends
Details
| Submitted | 2004-10-13 18:07 UTC |
|---|---|
| From | enrico dot scholz at informatik dot tu-chemnitz dot de |
| Assigned | danielc |
| Status | Closed |
| Package | XML_RPC |
| PHP Version | 4.3.9 |
| OS | linux |
| Roadmaps | (Not assigned) |
Comments
[2004-10-13 18:07 UTC] enrico dot scholz at informatik dot tu-chemnitz dot de
Description:
------------
XML/RPC.php translates every '\n' into '\r\n'. This causes problems when the transmitted data has already DOS lineends; they are becoming now '\r\r\n' which will have unexpected results on the server.
E.g. a python XML server translates them to '\n\n' which duplicates the lineends effectively.
Reproduce code:
---------------
<?php
require "XML/RPC.php";
$c = new XML_RPC_Client("/RPC2", "www", 80);
$v = new XML_RPC_Value("foo\r\nbar", "string");
$m = new XML_RPC_Message("test", array($v));
$c->send($m);
?>
======
$ strace -f -s9999 -e send php test.php
send(3, "POST /RPC2 ... <value><string>foo\r\r\nbar</string>...
~~~~~~~
Expected result:
----------------
'<string>foo\r\nbar</string>'
Actual result:
--------------
'<string>foo\r\r\nbar</string>'