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