php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46465 libxml expects DTD declaration while validating XML against RelaxNG or XSD
Submitted: 2008-11-02 17:55 UTC Modified: 2009-12-14 12:09 UTC
Votes:8
Avg. Score:4.4 ± 0.7
Reproduced:8 of 8 (100.0%)
Same Version:2 (25.0%)
Same OS:2 (25.0%)
From: faw217 at gmail dot com Assigned:
Status: No Feedback Package: XML Reader
PHP Version: 5.3.0alpha2 OS: GNU/Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: faw217 at gmail dot com
New email:
PHP Version: OS:

 

 [2008-11-02 17:55 UTC] faw217 at gmail dot com
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)
  }
}

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-11-03 08:38 UTC] jani@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.


 [2008-11-11 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2009-02-11 21:22 UTC] felipe@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.


 [2009-02-19 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Wed Dec 08 21:03:36 2021 UTC