ID: 50661 Updated by: rricha...@php.net Reported By: geoffers+phpbugs at gmail dot com Status: Open Bug Type: DOM XML related Operating System: Mac OS 10.5.8 PHP Version: 5.3SVN-2010-01-04 (SVN) -Assigned To: +Assigned To: rrichards New Comment:
Assign to self Previous Comments: ------------------------------------------------------------------------ [2010-01-04 20:58:36] geoffers+phpbugs at gmail dot com Description: ------------ DOMDocument::loadXML() does not support UTF-16 encoded XML. This breaks the XML spec which says, "All XML processors MUST accept the UTF-8 and UTF-16 encodings of Unicode". As such, DOMDocument::loadXML() is not a conformant XML processor. XMLReader supports this fine, which suggests something is wrong in the use of the libxml2 API. Reproduce code: --------------- <?php $data = "\xFE\xFF\x00\x3C\x00\x66\x00\x6F\x00\x6F\x00\x2F\x00\x3E"; $dom = new DOMDocument(); $dom->loadXML($data); echo $dom->saveXML(); Expected result: ---------------- <?xml version="1.0"?> <foo/> Actual result: -------------- PHP Warning: DOMDocument::loadXML(): Start tag expected, '<' not found in Entity, line: 1 in /Users/gsnedders/Desktop/foo.php on line 5 Warning: DOMDocument::loadXML(): Start tag expected, '<' not found in Entity, line: 1 in /Users/gsnedders/Desktop/foo.php on line 5 <?xml version="1.0"?> ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=50661&edit=1