#45824 [Opn->Bgs]: loadXML moves entity references from attribute value to before element

[email protected]
Newsgroups php.bugs
Message-ID <[email protected]>
 ID:               45824
 Updated by:       [email protected]
 Reported By:      marc at mongenet dot ch
-Status:           Open
+Status:           Bogus
 Bug Type:         DOM XML related
 Operating System: Linux
 PHP Version:      5.2.6
 New Comment:

You should read the warning, it produces:

Warning: DOMDocument::loadXML(): Entity 'eacute' not defined in Entity,

line: 2 in /Users/chregu/tmp/foo.php on line 6

eacute is not a entity which is defined by default (there are only 5 of

them)


Previous Comments:
------------------------------------------------------------------------

[2008-08-14 17:59:11] marc at mongenet dot ch

Description:
------------
When an attribute value contains an entity reference (like
a="&eacute;"), loadXML() moves this entity out of the attribute, just
before the owner element.

Reproduce code:
---------------
$doc = new DOMDocument();
$xml = '<!DOCTYPE e PUBLIC "1" "2">'."\n". # DOCTYPE just to appear
well-formed
       '<e><e a="&eacute;"/></e>'."\n";
$doc->loadXML($xml);
echo '<pre>', htmlspecialchars($doc->saveXML()), '</pre>';


Expected result:
----------------
<?xml version="1.0"?>
<!DOCTYPE e PUBLIC "1" "2">
<e><e a="&eacute;"/></e>


Actual result:
--------------
<?xml version="1.0"?>
<!DOCTYPE e PUBLIC "1" "2">
<e>&eacute;<e a=""/></e>



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=45824&edit=1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.