#42391 [Bgs]: DOM ignores several valid dtd entities.

From: Date: Thu, 23 Aug 2007 18:49:28 +0000
Subject: #42391 [Bgs]: DOM ignores several valid dtd entities.
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-116564@lists.php.net to get a copy of this message
ID: 42391 User updated by: linus dot martensson at elplan-gm dot se Reported By: linus dot martensson at elplan-gm dot se Status: Bogus Bug Type: DOM XML related Operating System: Linux - Ubuntu Feisty Fawn PHP Version: 5.2.3 New Comment: Then, may I recommend clarifying the documentation? The &nbsp; entity was, for example, handled without that extra option, and it is in the SAME file as one of the entities that fail to load! *This* is why I found the behaviour strange and decided to report the bug. Would you please clarify such behaviour? Linus Previous Comments: ------------------------------------------------------------------------ [2007-08-22 22:49:12] rrichards@php.net Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php You need to pass the LIBXML_DTDLOAD option to loadXML as external subsets are not loaded by default ------------------------------------------------------------------------ [2007-08-22 22:01:13] linus dot martensson at elplan-gm dot se Retouched the summary. ------------------------------------------------------------------------ [2007-08-22 21:45:43] linus dot martensson at elplan-gm dot se Description: ------------ The DOM parser fails to parse SEVERAL valid xhtml entities, such as &raquo; and &rArr;, even though both are specified in http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent and http://www.w3.org/TR/xhtml1/DTD/xhtml-symbol.ent. These two files (among others) are referred to by the specified doctype definition, xhtml1-strict.dtd. The parser is obviously not taking all valid xhtml entities into account, which is a serious problem. Reproduce code: --------------- <?php $d = new DOMDocument(); if(!$d->loadXML('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html><head></head><body>&#8658;&rArr;</body></html>')) var_dump(libxml_get_last_error()); Expected result: ---------------- No output, should correctly parse the document and store the two entities in the DOMDocument. Actual result: -------------- When the libXml error is retrieved, this is the apparent error: Line 1: Entity 'rArr' not defined. The parse is aborted. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=42391&edit=1

« previous php.bugs (#116564) next »