#45824 [NEW]: loadXML moves entity references from attribute value to before element

[email protected] ("marc at mongenet dot ch")
Newsgroups php.bugs
Message-ID <[email protected]>
From:             marc at mongenet dot ch
Operating system: Linux
PHP version:      5.2.6
PHP Bug Type:     DOM XML related
Bug description:  loadXML moves entity references from attribute value to before element

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 bug report at http://bugs.php.net/?id=45824&edit=1
-- 
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=45824&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=45824&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=45824&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=45824&r=fixedcvs
Fixed in release:             http://bugs.php.net/fix.php?id=45824&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=45824&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=45824&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=45824&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=45824&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=45824&r=notwrong
Not enough info:              http://bugs.php.net/fix.php?id=45824&r=notenoughinfo
Submitted twice:              http://bugs.php.net/fix.php?id=45824&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=45824&r=globals
PHP 4 support discontinued:   http://bugs.php.net/fix.php?id=45824&r=php4
Daylight Savings:             http://bugs.php.net/fix.php?id=45824&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=45824&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=45824&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=45824&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=45824&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=45824&r=mysqlcfg
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.