Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fix Bug #4950: Incorrect CDATA serializing

git-svn-id: http://svn.php.net/repository/pear/packages/XML_Util/trunk@259065 c90b9560-bf6c-de11-be94-00142212c4b1
  • Loading branch information...
commit fc77fa41ee0ad6a092024cce7fb5bf7c9e12d533 1 parent 044870c
Chuck Burgess authored
Showing with 3 additions and 2 deletions.
  1. +2 −1  Util.php
  2. +1 −1  tests/testBug_4950.phpt
View
3  Util.php
@@ -671,7 +671,8 @@ function createComment($content)
*/
function createCDataSection($data)
{
- return sprintf("<![CDATA[%s]]>", $data);
+ return sprintf("<![CDATA[%s]]>",
+ preg_replace('/\]\]>/', "]]>]]&gt;<![CDATA[", strval($data)));
}
/**
View
2  tests/testBug_4950.phpt
@@ -11,4 +11,4 @@ echo XML_Util::createTag("test", array(), "Content ]]></test> here!",
?>
--EXPECT--
TEST: test case provided in bug report
-<test><![CDATA[Content ]]>]]><![CDATA[</test> here!]]></test>
+<test><![CDATA[Content ]]>]]&gt;<![CDATA[</test> here!]]></test>
Please sign in to comment.
Something went wrong with that request. Please try again.