Bug #69910 [NEW]: relaxNGValidate() + libxml_disable_entity_loader don't work as expected.
From: tamerlaha at gmail dot com
Operating system: Ubuntu
PHP version: 5.5.26
Package: *XML functions
Bug Type: Bug
Bug description:relaxNGValidate() + libxml_disable_entity_loader don't work as expected.
Description:
------------
Script should return nothing if validation was successful.
With libxml_disable_entity_loader(False) it works as expected.
with libxml_disable_entity_loader(true);
Raise "failed to load external entity." and validation fails.
why is schema considered like external entity?
Test script:
---------------
<?php
libxml_use_internal_errors(true);
libxml_disable_entity_loader(true);
$contents = file_get_contents("zbx_screens_export.xml");
$xml = new DOMDocument();
if(!$xml->loadXML($contents)){
$errors = libxml_get_errors();
print_r ($errors);};
$result = $xml->relaxNGValidate("screens.rng");
if(!$result){
$errors = libxml_get_errors();
print_r ($errors);
};
?>
screens.rng http://pastebin.com/QTV6MHaw
zbx_screens_export.xml http://pastebin.com/AkcpLzwn
Actual result:
--------------
PHP Warning: DOMDocument::relaxNGValidate(): Invalid RelaxNG in
/home/tamerlan/relaxng.php on line 11
Array
(
[0] => LibXMLError Object
(
[level] => 1
[code] => 1549
[column] => 0
[message] => failed to load external entity "screens.rng"
[file] =>
[line] => 0
)
[1] => LibXMLError Object
(
[level] => 2
[code] => 1065
[column] => 0
[message] => xmlRelaxNGParse: could not load screens.rng
[file] =>
[line] => 0
)
)
--
Edit bug report at https://bugs.php.net/bug.php?id=69910&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=69910&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=69910&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=69910&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=69910&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=69910&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=69910&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=69910&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=69910&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=69910&r=support
Expected behavior: https://bugs.php.net/fix.php?id=69910&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=69910&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=69910&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=69910&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=69910&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=69910&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=69910&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=69910&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=69910&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=69910&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=69910&r=mysqlcfg
Thread (3 messages)
- tamerlaha at gmail dot com