xref: /PHP-8.1/ext/dom/tests/bug46185.phpt (revision bd9f4fa6)
1--TEST--
2Bug #46185 (importNode changes the namespace of an XML element).
3--EXTENSIONS--
4dom
5--FILE--
6<?php
7$aDOM = new DOMDocument();
8$aDOM->loadXML('<?xml version="1.0"?>
9<ns1:a xmlns:ns1="urn::ns"/>');
10$a= $aDOM->firstChild;
11
12$ok = new DOMDocument();
13$ok->loadXML('<?xml version="1.0"?>
14<ns1:ok xmlns:ns1="urn::ns" xmlns="urn::REAL"><watch-me xmlns:default="urn::BOGUS"/></ns1:ok>');
15
16$imported= $aDOM->importNode($ok->firstChild, true);
17$a->appendChild($imported);
18
19echo $aDOM->saveXML();
20?>
21--EXPECT--
22<?xml version="1.0"?>
23<ns1:a xmlns:ns1="urn::ns"><ns1:ok xmlns="urn::REAL"><watch-me xmlns:default="urn::BOGUS"/></ns1:ok></ns1:a>
24