From: faw217 at gmail dot com
Operating system: GNU/Linux
PHP version: 5.3.0alpha2
PHP Bug Type: XML related
Bug description: libxml expects DTD declaration while validating XML against
RelaxNG or XSD
Description:
------------
I experienced it using XMLReader, I don't know if it affects other tools
too:
Even if I set XMLReader to validate XML document against RelaxNG or XSD
schema, then libxml_get_errors() will obtain an error:
Validation failed: no DTD found!
Reproduce code:
---------------
libxml_use_internal_errors(true);
$XMLReader = new XMLReader;
$XMLReader->open('./path/to/file.xml');
$XMLReader->setRelaxNGSchema('./path/to/schema');
$XMLReader->setParserProperty(XMLReader::VALIDATE, true);
do
{
$element = @XMLReader->read();
} while ($element);
var_dump(libxml_get_errors());
Expected result:
----------------
array(0) {
}
Actual result:
--------------
array(1) {
[0]=>
object(LibXMLError)#2 (6) {
["level"]=>
int(X)
["code"]=>
int(X)
["column"]=>
int(X)
["message"]=>
string(33) "Validation failed: no DTD found !"
["file"]=>
string(X) "./path/to/file.xml"
["line"]=>
int(X)
}
}
--
Edit bug report at http://bugs.php.net/?id=46465&edit=1
--
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=46465&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=46465&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=46465&r=trysnapshot60
Fixed in CVS:
http://bugs.php.net/fix.php?id=46465&r=fixedcvs
Fixed in CVS and need be documented:
http://bugs.php.net/fix.php?id=46465&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=46465&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=46465&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=46465&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=46465&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=46465&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=46465&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=46465&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=46465&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=46465&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=46465&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=46465&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=46465&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=46465&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=46465&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=46465&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=46465&r=mysqlcfg