1--TEST-- 2php:function() edge cases 3--EXTENSIONS-- 4dom 5--FILE-- 6<?php 7 8$doc = new DOMDocument(); 9$doc->loadHTML('<a href="https://php.net">hello</a>'); 10$xpath = new DOMXpath($doc); 11$xpath->registerNamespace("php", "http://php.net/xpath"); 12$xpath->registerPHPFunctions(); 13try { 14 $xpath->query("//a[php:function(3)]"); 15} catch (TypeError $e) { 16 echo $e->getMessage(), "\n"; 17} 18try { 19 $xpath->query("//a[php:function()]"); 20} catch (Throwable $e) { 21 echo $e->getMessage(), "\n"; 22} 23 24?> 25--EXPECT-- 26Handler name must be a string 27Function name must be passed as the first argument 28