Skip to content

Commit 2607bda

Browse files
nielsdosbon
authored andcommitted
Fix viable next sibling search for replaceWith
Closes phpGH-11888.
1 parent 00f1ff1 commit 2607bda

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ PHP NEWS
3030
. Fix manually calling __construct() on DOM classes. (nielsdos)
3131
. Fixed bug GH-11830 (ParentNode methods should perform their checks
3232
upfront). (nielsdos)
33+
. Fix viable next sibling search for replaceWith. (nielsdos)
3334

3435
- Core:
3536
. Fixed oss-fuzz #60741 (Leak in open_basedir). (ilutov)
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
--TEST--
2+
replaceWith() with a non-viable next sibling
3+
--EXTENSIONS--
4+
dom
5+
--FILE--
6+
<?php
7+
$doc = new DOMDocument;
8+
$doc->loadXML(<<<XML
9+
<?xml version="1.0"?>
10+
<container>
11+
<child>
12+
<alone/>
13+
</child>
14+
</container>
15+
XML);
16+
17+
$container = $doc->documentElement;
18+
$child = $container->firstElementChild;
19+
$alone = $child->firstElementChild;
20+
21+
$child->after($alone);
22+
echo $doc->saveXML();
23+
$child->replaceWith($alone);
24+
echo $doc->saveXML();
25+
?>
26+
--EXPECT--
27+
<?xml version="1.0"?>
28+
<container>
29+
<child>
30+
31+
</child><alone/>
32+
</container>
33+
<?xml version="1.0"?>
34+
<container>
35+
<alone/>
36+
</container>

0 commit comments

Comments
 (0)