Req #63589 [Nab]: XMLWriter handling of double-quotes not consistent with other libxml extensions
Edit report at https://bugs.php.net/bug.php?id=63589&edit=1
ID: 63589
Updated by: mike@php.net
Reported by: franck at cassedanne dot com
Summary: XMLWriter handling of double-quotes not consistent
with other libxml extensions
Status: Not a 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:
After all, it probably is a difference at the library level, maybe check with libxml upstream?
Previous Comments:
------------------------------------------------------------------------
[2013-10-15 09:32:16] franck at cassedanne dot com
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.
------------------------------------------------------------------------
[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
Thread (8 messages)