xref: /php-src/ext/dom/tests/gh11682.phpt (revision 48b246e0)
1--TEST--
2Fix GH-11682 (Consecutive calls to DOMNode::before and DOMNode::remove unlink wrong nodes)
3--EXTENSIONS--
4dom
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
22echo $dom->saveXML();
23
24?>
25--EXPECT--
26<?xml version="1.0"?>
27<root><foo1/><foo2/><foo3/></root>
28