PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » XML » XML_DTD » Bug #778

Regular expression skips the first tag after the DOCTYPE in the DTD

Details

Submitted2004-02-17 16:06 UTC
Fromrshaull at simanage dot com
Assignedschst
StatusClosed
PackageXML_DTD
PHP Version4.3.4
OSWindows 2000
Roadmaps(Not assigned)

Comments

[2004-02-17 16:06 UTC] rshaull at simanage dot com

Description:
------------
The first <!ELEMENT is ignored in a DTD because the regular expression on line 127 of DTD.php pulls the contents of the first <!ELEMENT into the <!DOCTYPE [ element, so that the first match looks something like this:

DOCTYPE document [ <!ELEMENT document (page+)

I resolved it on my server by replacing '|<!([^>]+)>|s' with '/<!([^\[>]+)>/s'.

Please see http://dev.simanage.com/download/php-bugs/xml_dtd/001/ for a detailed report and tests.

Reproduce code:
---------------
Please visit this URL for full bug report:
http://dev.simanage.com/download/php-bugs/xml_dtd/001/

Expected result:
----------------
When I run the validator on pretty much an XML-DTD pair I get back 'invalid' because the first <!ELEMENT is not parsed into the XML tree that represents the DTD.

Actual result:
--------------
After applying my fix I get 'invalid' only for documents that are actually invalid and 'valid' for the rest.

[2004-05-17 23:32 UTC] rshaull at simanage dot com

Sorry about the unavailability. The page should be accessible now. I posted this report quite a while ago and had almost forgotten about it...

I think you are right (about "<!DOCTYPE [" not belonging in an external DTD). I don't write DTDs very often, and I guess I had the syntax confused with inline DTDs.

Well, thanks for checking into it.