From: geoffers+phpbugs at gmail dot com Operating system: Mac OS 10.5.8 PHP version: 5.3SVN-2010-01-04 (SVN) PHP Bug Type: DOM XML related Bug description: DOMDocument::loadXML does not allow UTF-16
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 bug report at http://bugs.php.net/?id=50661&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=50661&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=50661&r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=50661&r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=50661&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=50661&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=50661&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=50661&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=50661&r=needscript Try newer version: http://bugs.php.net/fix.php?id=50661&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=50661&r=support Expected behavior: http://bugs.php.net/fix.php?id=50661&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=50661&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=50661&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=50661&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=50661&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=50661&r=dst IIS Stability: http://bugs.php.net/fix.php?id=50661&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=50661&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=50661&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=50661&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=50661&r=mysqlcfg