Skip to content

Commit 24d7afd

Browse files
nielsdosdivinity76
andcommitted
Add test
Co-authored-by: divinity76 <[email protected]>
1 parent 8b75b76 commit 24d7afd

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

ext/dom/tests/gh13960.phpt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
--TEST--
2+
GH-13960 (NULL bytes in XPath query)
3+
--EXTENSIONS--
4+
dom
5+
--FILE--
6+
<?php
7+
$domd = new DOMDocument();
8+
@$domd->loadHTML("<foo>tes\x00t</foo>");
9+
$xp = new DOMXPath($domd);
10+
try {
11+
$xp->query("//foo[contains(text(), " . $xp->quote("tes\x00t") . ")]");
12+
} catch (ValueError $e) {
13+
echo $e->getMessage(), "\n";
14+
}
15+
?>
16+
--EXPECT--
17+
DOMXPath::quote(): Argument #1 ($str) must not contain any null bytes

0 commit comments

Comments
 (0)