PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » Web Services » XML_RPC » Bug #2521

Broken encoding of '\r\n' line-ends

Details

Submitted2004-10-13 18:07 UTC
Fromenrico dot scholz at informatik dot tu-chemnitz dot de
Assigneddanielc
StatusClosed
PackageXML_RPC
PHP Version4.3.9
OSlinux
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>'