1--TEST--
2replaceWith() with a non-viable next sibling
3--EXTENSIONS--
4dom
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>
15XML);
16
17$container = $doc->documentElement;
18$child = $container->firstElementChild;
19$alone = $child->firstElementChild;
20
21$child->after($alone);
22echo $doc->saveXML();
23$child->replaceWith($alone);
24echo $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>
37