PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Web Services » XML_RPC » Bug #1370

serializeDebug() does not properly escape --

Details

Submitted2004-05-09 21:23 UTC
Frombugs dot pear dot net at chsc dot dk
Assignedpajoye
StatusClosed
PackageXML_RPC
PHP VersionIrrelevant
OSLinux
Roadmaps(Not assigned)

Comments

[2004-05-09 21:23 UTC] bugs dot pear dot net at chsc dot dk

Description:
------------
In XML, comments may not contain "--" (two consecutive dashes) between the opening and closing tags (see http://www.w3.org/TR/2004/REC-xml-20040204/#sec-comments ), i.e. the following is malformed:
<!-- this is a -- comment -->

The XML_RPC_Server::serializeDebug method outputs a string in a comment tag without any escaping. If the string contains "--", the output becomes malformed XML.

I have changed serializeDebug so that it adds a space between consecutive dashes. This fixes the problem.

function serializeDebug()
{
global $XML_RPC_Server_debuginfo;
if ($XML_RPC_Server_debuginfo != "") {
return "<!-- DEBUG INFO:\n\n" .
preg_replace('/-(?=-)/', '- ', $XML_RPC_Server_debuginfo) .
"\n-->\n";
} else {
return "";
}
}

[2004-05-31 17:31 UTC] pierre at dotgeek dot org

This bug has been fixed in CVS.

In case this was a documentation problem, the fix will show up at the
end of next Sunday (CET) on pear.php.net.

In case this was a pear.php.net website problem, the change will show
up on the website in short time.

Thank you for the report, and for helping us make PEAR better.