1--TEST--
2Serialize element choose nearest prefix if unqualified name
3--EXTENSIONS--
4dom
5--FILE--
6<?php
7
8$dom = DOM\XMLDocument::createFromString('<root xmlns:p1="u1"><child xmlns:p2="u1"><p1:child2/></child></root>');
9echo $dom->saveXML(), "\n";
10
11$dom = DOM\XMLDocument::createFromString('<root xmlns:p1="u1"><child xmlns:p2="u1"></child></root>');
12$root = $dom->documentElement;
13$child2 = $root->ownerDocument->createElementNS('u1', 'child2');
14$root->firstChild->appendChild($child2);
15echo $dom->saveXML(), "\n";
16
17?>
18--EXPECT--
19<?xml version="1.0" encoding="UTF-8"?>
20<root xmlns:p1="u1"><child xmlns:p2="u1"><p1:child2/></child></root>
21<?xml version="1.0" encoding="UTF-8"?>
22<root xmlns:p1="u1"><child xmlns:p2="u1"><p2:child2/></child></root>
23