mirror of
https://github.com/php/php-src.git
synced 2026-10-28 17:56:50 +08:00
28 lines
635 B
PHP
28 lines
635 B
PHP
--TEST--
|
|
php:function() edge cases
|
|
--EXTENSIONS--
|
|
dom
|
|
--FILE--
|
|
<?php
|
|
|
|
$doc = new DOMDocument();
|
|
$doc->loadHTML('<a href="https://php.net">hello</a>');
|
|
$xpath = new DOMXpath($doc);
|
|
$xpath->registerNamespace("php", "http://php.net/xpath");
|
|
$xpath->registerPHPFunctions();
|
|
try {
|
|
$xpath->query("//a[php:function(3)]");
|
|
} catch (Throwable $e) {
|
|
echo $e::class, ': ', $e->getMessage(), "\n";
|
|
}
|
|
try {
|
|
$xpath->query("//a[php:function()]");
|
|
} catch (Throwable $e) {
|
|
echo $e::class, ': ', $e->getMessage(), "\n";
|
|
}
|
|
|
|
?>
|
|
--EXPECT--
|
|
TypeError: Handler name must be a string
|
|
Error: Function name must be passed as the first argument
|