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) {}));
20var_dump($dd->validate());
21
22echo "Done.\n";
23
24--EXPECTF--
25Warning: libxml_set_external_entity_loader() expects parameter 1 to be a valid callback, array must have exactly two members in %s on line %d
26NULL
27
28Warning: libxml_set_external_entity_loader() expects exactly 1 parameter, 0 given in %s on line %d
29NULL
30
31Warning: libxml_set_external_entity_loader() expects exactly 1 parameter, 2 given in %s on line %d
32NULL
33bool(true)
34
35Warning: Missing argument 4 for {closure}() in %s on line %d
36
37Warning: DOMDocument::validate(): Could not load the external subset "http://example.com/foobar" in %s on line %d
38bool(false)
39Done.
40