#50661 [Asn->Csd]: DOMDocument::loadXML does not allow UTF-16

From: Date: Wed, 06 Jan 2010 13:16:37 +0000
Subject: #50661 [Asn->Csd]: DOMDocument::loadXML does not allow UTF-16
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-146379@lists.php.net to get a copy of this message
ID: 50661 Updated by: rrichards@php.net Reported By: geoffers+phpbugs at gmail dot com -Status: Assigned +Status: Closed Bug Type: DOM XML related Operating System: Mac OS 10.5.8 PHP Version: 5.3SVN-2010-01-04 (SVN) Assigned To: rrichards New Comment: This bug has been fixed in SVN. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. Thank you for the report, and for helping us make PHP better. Previous Comments: ------------------------------------------------------------------------ [2010-01-06 13:13:18] svn@php.net Automatic comment from SVN on behalf of rrichards Revision: http://svn.php.net/viewvc/?view=revision&revision=293176 Log: fix bug #50661 (DOMDocument::loadXML does not allow UTF-16) add test ------------------------------------------------------------------------ [2010-01-04 23:16:49] rrichards@php.net Assign to self ------------------------------------------------------------------------ [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

« previous php.bugs (#146379) next »