1--TEST-- 2Bug #47847 (importNode loses the namespace of an XML element) 3--EXTENSIONS-- 4dom 5--XFAIL-- 6See https://github.com/php/php-src/pull/12308 7--FILE-- 8<?php 9$fromdom = new DOMDocument(); 10$fromdom->loadXML(<<<XML 11<?xml version="1.0"?> 12<ns:container xmlns:ns="http://php.net"> 13<ns:inner xmlns="http://php.net"> 14<ns:WATCH-MY-NAMESPACE xmlns=""/> 15</ns:inner> 16</ns:container> 17XML); 18 19$aDOM = new DOMDocument(); 20$imported = $aDOM->importNode($fromdom->documentElement->firstElementChild, true); 21$aDOM->appendChild($imported); 22 23echo $aDOM->saveXML(); 24?> 25--EXPECT-- 26<?xml version="1.0"?> 27<ns:inner xmlns="http://php.net" xmlns:ns="http://php.net"> 28<ns:WATCH-MY-NAMESPACE xmlns=""/> 29</ns:inner> 30