1--TEST--
2libxml_set_external_entity_loader() error: bad arguments
3--SKIPIF--
4<?php if (!extension_loaded('dom')) die('skip'); ?>
5--FILE--
6<?php
7$xml = <<<XML
8<!DOCTYPE foo PUBLIC "-//FOO/BAR" "http://example.com/foobar">
9<foo>bar</foo>
10XML;
11
12$dd = new DOMDocument;
13$r = $dd->loadXML($xml);
14
15var_dump(libxml_set_external_entity_loader([]));
16var_dump(libxml_set_external_entity_loader());
17var_dump(libxml_set_external_entity_loader(function() {}, 2));
18
19var_dump(libxml_set_external_entity_loader(function($a, $b, $c, $d) {}));
20try {
21	var_dump($dd->validate());
22} catch (Throwable $e) {
23	echo "Exception: " . $e->getMessage() . "\n";
24}
25
26echo "Done.\n";
27--EXPECTF--
28Warning: libxml_set_external_entity_loader() expects parameter 1 to be a valid callback, array must have exactly two members in %s on line %d
29NULL
30
31Warning: libxml_set_external_entity_loader() expects exactly 1 parameter, 0 given in %s on line %d
32NULL
33
34Warning: libxml_set_external_entity_loader() expects exactly 1 parameter, 2 given in %s on line %d
35NULL
36bool(true)
37
38Warning: DOMDocument::validate(): Could not load the external subset "http://example.com/foobar" in %s on line %d
39Exception: Too few arguments to function {closure}(), 3 passed and exactly 4 expected
40Done.
41