xref: /PHP-8.4/ext/dom/tests/gh13960.phpt (revision a136117e)
1--TEST--
2GH-13960 (NULL bytes in XPath query)
3--EXTENSIONS--
4dom
5--FILE--
6<?php
7$domd = new DOMDocument();
8@$domd->loadHTML("<foo>tes\x00t</foo>");
9$xp = new DOMXPath($domd);
10try {
11    $xp->query("//foo[contains(text(), " . $xp->quote("tes\x00t") . ")]");
12} catch (ValueError $e) {
13    echo $e->getMessage(), "\n";
14}
15?>
16--EXPECT--
17DOMXPath::quote(): Argument #1 ($str) must not contain any null bytes
18