Skip to content

Commit 48b246e

Browse files
nielsdostheseer
andcommitted
Add regression test for GH-11682
This bug was already fixed via 15ff830, but we really need more test coverage. Co-authored-by: Arne Blankerts <[email protected]>
1 parent bc42179 commit 48b246e

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

ext/dom/tests/gh11682.phpt

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
--TEST--
2+
Fix GH-11682 (Consecutive calls to DOMNode::before and DOMNode::remove unlink wrong nodes)
3+
--EXTENSIONS--
4+
dom
5+
--FILE--
6+
<?php
7+
8+
$dom = new DOMDocument;
9+
$dom->loadXML('<?xml version="1.0" ?><root><node /></root>');
10+
11+
$list = [
12+
$dom->createElement('foo1'),
13+
$dom->createElement('foo2'),
14+
$dom->createElement('foo3')
15+
];
16+
17+
$node = $dom->getElementsByTagName('node')->item(0);
18+
19+
$node->before(...$list);
20+
$node->remove();
21+
22+
echo $dom->saveXML();
23+
24+
?>
25+
--EXPECT--
26+
<?xml version="1.0"?>
27+
<root><foo1/><foo2/><foo3/></root>

0 commit comments

Comments
 (0)