1--TEST-- 2Bug #55294 (DOMDocument::importNode shifts namespaces when "default" namespace exists) 3--EXTENSIONS-- 4dom 5--FILE-- 6<?php 7 8$aDOM = Dom\XMLDocument::createFromString(<<<EOXML 9<A xmlns="http://example.com/A"> 10<B> 11<C xmlns="http://example.com/C" xmlns:default="http://example.com/Z" /> 12</B> 13</A> 14EOXML 15); 16 17$bDOM = Dom\XMLDocument::createEmpty(); 18$node = $bDOM->importNode($aDOM->getElementsByTagNameNS('http://example.com/A', 'B')->item(0), true); 19$bDOM->appendChild($node); 20 21echo $bDOM->saveXml(), "\n"; 22 23?> 24--EXPECT-- 25<?xml version="1.0" encoding="UTF-8"?> 26<B xmlns="http://example.com/A"> 27<C xmlns="http://example.com/C" xmlns:default="http://example.com/Z"/> 28</B> 29