xref: /PHP-8.2/ext/dom/tests/bug47848.phpt (revision bd9f4fa6)
1--TEST--
2Bug #47848 (importNode doesn't preserve attribute namespaces)
3--EXTENSIONS--
4dom
5--FILE--
6<?php
7
8$aDOM = new DOMDocument();
9$aDOM->appendChild($aDOM->createElementNS('http://friend2friend.net/','f2f:a'));
10
11$fromdom = new DOMDocument();
12$fromdom->loadXML('<data xmlns:ai="http://altruists.org" ai:attr="namespaced" />');
13
14$attr= $fromdom->firstChild->attributes->item(0);
15
16$att = $aDOM->importNode($attr);
17
18$aDOM->documentElement->appendChild($aDOM->importNode($attr, true));
19
20echo $aDOM->saveXML();
21
22?>
23--EXPECT--
24<?xml version="1.0"?>
25<f2f:a xmlns:f2f="http://friend2friend.net/" xmlns:ai="http://altruists.org" ai:attr="namespaced"/>
26