Permalink
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...
ashnazg committed May 4, 2008
1 parent 044870c commit fc77fa41ee0ad6a092024cce7fb5bf7c9e12d533
Showing with 3 additions and 2 deletions.
  1. +2 −1 Util.php
  2. +1 −1 tests/testBug_4950.phpt
View
@@ -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
@@ -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>

0 comments on commit fc77fa4

Please sign in to comment.