xref: /php-src/ext/dom/tests/gh11347.phpt (revision 78127721)
1--TEST--
2GH-11347 (Memory leak when calling a static method inside an xpath query)
3--EXTENSIONS--
4dom
5--FILE--
6<?php
7
8class MyClass
9{
10    public static function dump(string $var) {
11        var_dump($var);
12    }
13}
14
15$doc = new DOMDocument();
16$doc->loadHTML('<a href="https://php.net">hello</a>');
17$xpath = new DOMXpath($doc);
18$xpath->registerNamespace("php", "http://php.net/xpath");
19$xpath->registerPHPFunctions();
20$xpath->query("//a[php:function('MyClass::dump', string(@href))]");
21
22?>
23Done
24--EXPECT--
25string(15) "https://php.net"
26Done
27