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 $proc->importStylesheet($xsl); 26 $proc->transformToDoc($inputdom); 27} 28 29try { 30 test(""); 31} catch (Throwable $e) { 32 echo $e->getMessage(), "\n"; 33} 34 35try { 36 test("3"); 37} catch (TypeError $e) { 38 echo $e->getMessage(), "\n"; 39} 40 41?> 42--EXPECT-- 43Function name must be passed as the first argument 44Handler name must be a string 45