xref: /PHP-8.4/ext/dom/tests/modern/spec/gh11404_2.phpt (revision 6e7adb3c)
1--TEST--
2GH-11404 (DOMDocument::savexml and friends ommit xmlns="" declaration for null namespace, creating incorrect xml representation of the DOM)
3--EXTENSIONS--
4dom
5--FILE--
6<?php
7
8$dom1 = Dom\XMLDocument::createFromString('<?xml version="1.0" ?><with xmlns="some:ns" />');
9
10$dom2 = Dom\XMLDocument::createFromString('<?xml version="1.0" ?><none />');
11
12$dom1->documentElement->append(
13    $dom1->importNode(
14        $dom2->documentElement
15    )
16);
17
18echo $dom1->saveXml();
19?>
20--EXPECT--
21<?xml version="1.0" encoding="UTF-8"?>
22<with xmlns="some:ns"><none xmlns=""/></with>
23