#44619 [Bgs]: XMLWriter doesn't escape CDATA
| From: | rrichards@php.net | Date: | Wed, 02 Apr 2008 21:21:01 +0000 |
| Subject: | #44619 [Bgs]: XMLWriter doesn't escape CDATA | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-123892@lists.php.net to get a copy of this message | ||
ID: 44619
Updated by: rrichards@php.net
Reported By: evert at rooftopsolutions dot nl
Status: Bogus
Bug Type: XML Writer
Operating System: Debian
PHP Version: 5.2.5
New Comment:
There are a lot of things that will break XML if put into CDATA
sections. In most cases, data should be encoded and CDATA sections not
used.
Previous Comments:
------------------------------------------------------------------------
[2008-04-02 21:09:02] evert at rooftopsolutions dot nl
Should this be a documentation bug then? Nested CDATA tags are never
allowed..
See also wikipedia, which actually recommends a similar approach:
http://en.wikipedia.org/wiki/Cdata
------------------------------------------------------------------------
[2008-04-02 21:05:06] rrichards@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
no escaping is supposed to be performed. It is up to you to make sure
that the data is acceptable there.
------------------------------------------------------------------------
[2008-04-02 20:12:23] evert at rooftopsolutions dot nl
Description:
------------
XMLWriter does not escape ]]> in the writeCDATA method
Reproduce code:
---------------
<?php
$xml = new XMLWriter();
$xml->openMemory();
$xml->startDocument();
$xml->startElement('test');
$xml->writeCDATA('<![CDATA[blabla]]>');
$xml->endElement();
echo $xml->outputMemory();
?>
Expected result:
----------------
<?xml version="1.0"?>
<test><![CDATA[<![CDATA[blabla]]]]><![CDATA[>]]></test>
Actual result:
--------------
<?xml version="1.0"?>
<test><![CDATA[<![CDATA[blabla]]>]]></test>
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=44619&edit=1