php-src/ext/dom/tests/DOMXPath_evaluate_node_set_to_string.phpt
Niels Dossche 49b8168ddb Cover more paths in dom_xpath_ext_function_php() with tests
Also removes an incorrect comment: we *do* need the special namespace
node handling code, otherwise we'd segfault.
2023-10-12 22:58:52 +02:00

26 lines
585 B
PHP

--TEST--
DOMXPath::evaluate() with PHP function passing node-set returning a string
--EXTENSIONS--
dom
--FILE--
<?php
$dom = new DOMDocument();
$dom->loadXML(<<<XML
<?xml version="1.0"?>
<container>
<p>hi</p>
</container>
XML);
$xpath = new DOMXPath($dom);
$xpath->registerNamespace("php", "http://php.net/xpath");
$xpath->registerPhpFunctions(['strrev']);
var_dump($xpath->evaluate('php:functionString("strrev", //p)'));
var_dump($xpath->evaluate('php:functionString("strrev", //namespace::*)'));
?>
--EXPECT--
string(2) "ih"
string(36) "ecapseman/8991/LMX/gro.3w.www//:ptth"