#45824 [Opn->Bgs]: loadXML moves entity references from attribute value to before element
| From: | chregu@php.net | Date: | Fri, 15 Aug 2008 06:34:08 +0000 |
| Subject: | #45824 [Opn->Bgs]: loadXML moves entity references from attribute value to before element | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-128099@lists.php.net to get a copy of this message | ||
ID: 45824
Updated by: chregu@php.net
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="é"), 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="é"/></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="é"/></e>
Actual result:
--------------
<?xml version="1.0"?>
<!DOCTYPE e PUBLIC "1" "2">
<e>é<e a=""/></e>
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=45824&edit=1