#48512 [Opn->Asn]: DOMDocument::validate() fails with both a E_NOTICE and E_WARN if no DTD
| From: | iliaa@php.net | Date: | Wed, 10 Jun 2009 12:25:51 +0000 |
| Subject: | #48512 [Opn->Asn]: DOMDocument::validate() fails with both a E_NOTICE and E_WARN if no DTD | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-138161@lists.php.net to get a copy of this message | ||
ID: 48512
Updated by: iliaa@php.net
Reported By: knut@php.net
-Status: Open
+Status: Assigned
Bug Type: DOM XML related
Operating System: Mac OS X 10.5.7
PHP Version: 5.3CVS-2009-06-09 (CVS)
-Assigned To:
+Assigned To: iliaa
Previous Comments:
------------------------------------------------------------------------
[2009-06-09 18:25:58] knut@php.net
Description:
------------
The TestFest seems to be working :) Just found a strange behavior in
DOMDocument::validate(). If no DTD is given you'll both have a E_NOTICE
and a E_WARN saying pretty much the same. Looking at the implementation
it seems like PHP tries to define this behavior as a E_NOTICE, while it
will fail in libxml as a E_WARN.
I would expect this method to raise just one of the error messages, not
both.
The E_NOTICE is raised in line 1941 in ext/dom/document.c
Reproduce code:
---------------
<?php
$xml = "<?xml version=\"1.0\"?>
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend</body>
</note>";
$dom = new DOMDocument('1.0');
$dom->loadXML($xml);
var_dump($dom->validate());
?>
Expected result:
----------------
Warning: DOMDocument::validate(): no DTD found! in %s on line 11
Actual result:
--------------
Notice: DOMDocument::validate(): No DTD given in XML-Document in %s on
line 11
Warning: DOMDocument::validate(): no DTD found! in %s on line 11
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=48512&edit=1