1--TEST--
2GH-9628 (Implicitly removing nodes from \DOMDocument breaks existing references) - simple variation
3--EXTENSIONS--
4dom
5--FILE--
6<?php
7$html = <<<'HTML'
8<p xmlns="some:ns">
9    <span id="1" xmlns:test="some:ns2">
10        <strong>
11            <span id="2">Test <test:test/></span>
12        </strong>
13    </span>
14</p>
15HTML;
16
17$doc = new DOMDocument('1.0', 'UTF-8');
18$doc->loadXML($html);
19
20$outer_span = $doc->documentElement->firstElementChild;
21$inner_span = $outer_span->firstElementChild->firstElementChild;
22var_dump($inner_span->namespaceURI);
23
24// Remove strong
25$outer_span->firstElementChild->remove();
26
27var_dump($inner_span->getAttribute('id'));
28var_dump($inner_span->namespaceURI);
29
30// Import test
31$doc = new DOMDocument();
32$doc->append($doc->importNode($outer_span, true), $doc->importNode($inner_span, true));
33echo $doc->saveXML();
34
35var_dump($inner_span->getAttribute('id'));
36var_dump($inner_span->namespaceURI);
37?>
38--EXPECT--
39string(7) "some:ns"
40string(1) "2"
41string(7) "some:ns"
42<?xml version="1.0"?>
43<span xmlns:test="some:ns2" xmlns="some:ns" id="1">
44
45    </span>
46<default:span xmlns:default="some:ns" xmlns:test="some:ns2" id="2">Test <test:test/></default:span>
47string(1) "2"
48string(7) "some:ns"
49