Edit report at https://bugs.php.net/bug.php?id=63589&edit=1
ID: 63589 Updated by: m...@php.net Reported by: franck at cassedanne dot com Summary: XMLWriter handling of double-quotes not consistent with other libxml extensions -Status: Open +Status: Not a bug Type: Bug 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: It just forwards the call to libxml's xmlwriter, so nothing we can do about it. Previous Comments: ------------------------------------------------------------------------ [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