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