1--TEST--
2registerPHPFunctionNS() function - error cases
3--EXTENSIONS--
4xsl
5--FILE--
6<?php
7
8class TrampolineClass {
9    public function __call($name, $args) {
10    }
11}
12
13require __DIR__ . '/xpath_callables.inc';
14
15try {
16    createProcessor([])->registerPhpFunctionNS('http://php.net/xsl', 'strtolower', strtolower(...));
17} catch (ValueError $e) {
18    echo $e->getMessage(), "\n";
19}
20
21try {
22    createProcessor([])->registerPhpFunctionNS('http://php.net/xsl', 'test', [new TrampolineClass, 'test']);
23} catch (ValueError $e) {
24    echo $e->getMessage(), "\n";
25}
26
27try {
28    createProcessor([])->registerPhpFunctionNS('urn:foo', '$$$', [new TrampolineClass, 'test']);
29} catch (ValueError $e) {
30    echo $e->getMessage(), "\n";
31}
32
33try {
34    createProcessor([])->registerPhpFunctionNS('urn:foo', 'x:a', strtolower(...));
35} catch (ValueError $e) {
36    echo $e->getMessage(), "\n";
37}
38
39try {
40    createProcessor([])->registerPhpFunctionNS("urn:foo", "\0", strtolower(...));
41} catch (ValueError $e) {
42    echo $e->getMessage(), "\n";
43}
44
45try {
46    createProcessor([])->registerPhpFunctionNS("\0", 'strtolower', strtolower(...));
47} catch (ValueError $e) {
48    echo $e->getMessage(), "\n";
49}
50
51?>
52--EXPECT--
53XSLTProcessor::registerPHPFunctionNS(): Argument #1 ($namespaceURI) must not be "http://php.net/xsl" because it is reserved by PHP
54XSLTProcessor::registerPHPFunctionNS(): Argument #1 ($namespaceURI) must not be "http://php.net/xsl" because it is reserved by PHP
55XSLTProcessor::registerPHPFunctionNS(): Argument #2 ($name) must be a valid callback name
56XSLTProcessor::registerPHPFunctionNS(): Argument #2 ($name) must be a valid callback name
57XSLTProcessor::registerPHPFunctionNS(): Argument #2 ($name) must not contain any null bytes
58XSLTProcessor::registerPHPFunctionNS(): Argument #1 ($namespaceURI) must not contain any null bytes
59