xref: /PHP-8.0/ext/libxml/tests/bug76777.phpt (revision 5dafd7b4)
1--TEST--
2Bug #76777 (first parameter of libxml_set_external_entity_loader callback undefined)
3--SKIPIF--
4<?php
5if (!extension_loaded('libxml')) die('skip libxml extension not available');
6if (!extension_loaded('dom')) die('skip dom extension not available');
7if (getenv("SKIP_ONLINE_TESTS")) die('skip online test');
8?>
9--FILE--
10<?php
11$xml=<<<EOF
12<?xml version="1.0"?>
13<test/>
14EOF;
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>
22EOF;
23
24libxml_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--EXPECT--
33NULL
34string(15) "nonexistent.xsd"
35array(4) {
36  ["directory"]=>
37  NULL
38  ["intSubName"]=>
39  NULL
40  ["extSubURI"]=>
41  NULL
42  ["extSubSystem"]=>
43  NULL
44}
45