Bug->Req #63589 [Nab]: XMLWriter handling of double-quotes not consistent with other libxml extensions
| From: | franck at cassedanne dot com | Date: | Tue, 15 Oct 2013 09:32:16 +0000 |
| Subject: | Bug->Req #63589 [Nab]: XMLWriter handling of double-quotes not consistent with other libxml extensions | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-182153@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=63589&edit=1
ID: 63589
User updated by: franck at cassedanne dot com
Reported by: franck at cassedanne dot com
Summary: XMLWriter handling of double-quotes not consistent
with other libxml extensions
Status: Not a bug
-Type: Bug
+Type: Feature/Change Request
Package: XML Writer
Operating System: BSD, Linux, OSX
PHP Version: 5.3.19, 5.4.9
Block user comment: N
Private report: N
New Comment:
All the other libxml based extensions out there (SimpleXML, DOMDocument, Tidy) which are all
supposedly also forwarding their calls to that library, are consistent in the matter.
Only XMLWriter is acting differently -- maybe this should be changed to "Feature/Change
Request" if it is not considered a Bug.
Previous Comments:
------------------------------------------------------------------------
[2013-10-02 07:36:51] mike@php.net
It just forwards the call to libxml's xmlwriter, so nothing we can do about it.
------------------------------------------------------------------------
[2012-11-23 19:35:32] franck at cassedanne dot com
The same issue is present on PHP 5.4.9
------------------------------------------------------------------------
[2012-11-23 18:56:09] franck at cassedanne dot com
Description:
------------
XMLWriter differs in its handling of double-quotes when compared to other libxml
based PHP extensions.
Double-quotes using XMLWriter are converted to htmlentities (i.e. '"').
Using SimpleXML or DOMDocument double-quotes stay unconverted.
It seems to me that XMLWriter should not be converting double-quotes either.
Tidy seems to also agree -- try the following in a CLI:
$ echo "<?xml encoding=\"UTF-8\"?><tag>"</tag>" |
tidy -xml -q
Maybe introducing a flag/constant such as ENT_NOQUOTES to toggle the conversion of
these on and off might be pertinent.
Test script:
---------------
<?php
$x = new XMLWriter;
$x->openMemory();
$x->startDocument('1.0', 'UTF-8');
$x->writeElement('tag', '"');
$x->endDocument();
echo $x->flush();
Expected result:
----------------
<?xml version=\"1.0\" encoding=\"UTF-8\"?><tag>"</tag>
Actual result:
--------------
<?xml version=\"1.0\"
encoding=\"UTF-8\"?><tag>"</tag>
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=63589&edit=1