1--TEST--
2Reconciliation of elements
3--EXTENSIONS--
4dom
5--FILE--
6<?php
7
8$dom = Dom\XMLDocument::createFromString(<<<XML
9<?xml version="1.0"?>
10<root>
11    <a:root1 xmlns:a="urn:a">
12        <a:root2 xmlns:a="urn:b">
13            <a:child xmlns:b="urn:b">
14                <b:child1 xmlns:a="urn:x">bar</b:child1>
15            </a:child>
16        </a:root2>
17    </a:root1>
18</root>
19XML);
20
21$root = $dom->documentElement;
22$a_child = $dom->getElementsByTagName("a:child")[0];
23
24$root->append($a_child);
25
26echo $dom->saveXml(), "\n";
27
28echo "---\n";
29
30// Trigger reconciliation via detach logic in ext/libxml
31$root->remove();
32unset($root);
33
34echo $dom->saveXml($a_child), "\n";
35
36?>
37--EXPECT--
38<?xml version="1.0" encoding="UTF-8"?>
39<root>
40    <a:root1 xmlns:a="urn:a">
41        <a:root2 xmlns:a="urn:b">
42
43        </a:root2>
44    </a:root1>
45<b:child xmlns:b="urn:b">
46                <b:child1 xmlns:a="urn:x">bar</b:child1>
47            </b:child></root>
48---
49<b:child xmlns:b="urn:b">
50                <b:child1 xmlns:a="urn:x">bar</b:child1>
51            </b:child>
52