1--TEST--
2php:function() edge cases
3--EXTENSIONS--
4xsl
5--FILE--
6<?php
7
8function test($input) {
9    $xsl = new DomDocument();
10    $xsl->loadXML('<?xml version="1.0" encoding="iso-8859-1" ?>
11    <xsl:stylesheet version="1.0"
12    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
13    xmlns:php="http://php.net/xsl">
14    <xsl:template match="/">
15    <xsl:value-of select="php:function(' . $input . ')" />
16    </xsl:template>
17    </xsl:stylesheet>');
18
19    $inputdom = new DomDocument();
20    $inputdom->loadXML('<?xml version="1.0" encoding="iso-8859-1" ?>
21    <today></today>');
22
23    $proc = new XsltProcessor();
24    $proc->registerPhpFunctions();
25    $xsl = $proc->importStylesheet($xsl);
26    try {
27        $proc->transformToDoc($inputdom);
28    } catch (Exception $e) {
29        echo $e->getMessage(), "\n";
30    }
31}
32
33try {
34    test("");
35} catch (Throwable $e) {
36    echo $e->getMessage(), "\n";
37}
38
39test("3");
40
41?>
42--EXPECTF--
43Function name must be passed as the first argument
44
45Warning: XSLTProcessor::transformToDoc(): Handler name must be a string in %s on line %d
46