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