]> granicus.if.org Git - php/blob
5e15024b81
[php] /
1 --TEST--
2 Bug #76777 (first parameter of libxml_set_external_entity_loader callback undefined)
3 --SKIPIF--
4 <?php
5 if (!extension_loaded('libxml')) die('skip libxml extension not available');
6 if (!extension_loaded('dom')) die('skip dom extension not available');
7 if (getenv("SKIP_ONLINE_TESTS")) die('skip online test');
8 ?>
9 --FILE--
10 <?php
11 $xml=<<<EOF
12 <?xml version="1.0"?>
13 <test/>
14 EOF;
15
16 $xsd=<<<EOF
17 <?xml version="1.0"?>
18 <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
19   <xs:include schemaLocation="nonexistent.xsd"/>
20   <xs:element name="test"/>
21 </xs:schema>
22 EOF;
23
24 libxml_set_external_entity_loader(function($p,$s,$c) {
25     var_dump($p,$s,$c);
26     die();
27 });
28
29 $dom=new DOMDocument($xml);
30 $dom->schemaValidateSource($xsd);
31 ?>
32 --EXPECTF--
33 NULL
34 string(15) "nonexistent.xsd"
35 array(4) {
36   ["directory"]=>
37   NULL
38   ["intSubName"]=>
39   NULL
40   ["extSubURI"]=>
41   NULL
42   ["extSubSystem"]=>
43   NULL
44 }