xref: /PHP-8.2/ext/dom/tests/bug55294.phpt (revision e127f871)
1--TEST--
2Bug #55294 (DOMDocument::importNode shifts namespaces when "default" namespace exists)
3--EXTENSIONS--
4dom
5--XFAIL--
6See https://github.com/php/php-src/pull/12308
7--FILE--
8<?php
9
10$aDOM = new DOMDocument();
11$aDOM->loadXML(<<<EOXML
12<A xmlns="http://example.com/A">
13<B>
14<C xmlns="http://example.com/C" xmlns:default="http://example.com/Z" />
15</B>
16</A>
17EOXML
18);
19
20$bDOM = new DOMDocument();
21$node = $bDOM->importNode($aDOM->getElementsByTagNameNS('http://example.com/A', 'B')->item(0), true);
22$bDOM->appendChild($node);
23
24echo $bDOM->saveXML(), "\n";
25
26?>
27--EXPECT--
28<?xml version="1.0"?>
29<B xmlns="http://example.com/A">
30<C xmlns="http://example.com/C" xmlns:default="http://example.com/Z"/>
31</B>
32