Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.5.2

Bug #778 Regular expression skips the first tag after the DOCTYPE in the DTD
Submitted: 2004-02-17 16:06 UTC
From: rshaull at simanage dot com Assigned: schst
Status: Closed Package: XML_DTD
PHP Version: 4.3.4 OS: Windows 2000
Roadmaps: (Not assigned)    
Subscription  


 [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.

Comments

 [2004-05-17 19:43 UTC] schst
http://dev.simanage.com/download/php-bugs/xml_dtd/001/ cannot be reached :-( Furthermore, I think that a DTD should not contain <!DOCTYPE. This either is used to to include an external DTD using the SYSTEM keyword or if you are using an inline DTD, it marks the beginning of the DTD. Stephan
 [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.