1--TEST--
2Reconcile a reused namespace from doc->oldNs
3--EXTENSIONS--
4dom
5--FILE--
6<?php
7
8$dom = new DOMDocument();
9$root = $dom->createElementNS('http://www.w3.org/2000/xhtml', 'html');
10
11$dom->loadXML(<<<XML
12<?xml version="1.0"?>
13<html
14    xmlns="http://www.w3.org/2000/xhtml"
15    xmlns:a="http://example.com/A"
16    xmlns:b="http://example.com/B"
17/>
18XML);
19$root = $dom->firstElementChild;
20
21echo "Add first\n";
22$element = $dom->createElementNS('http://example.com/B', 'p', 'Hello World');
23$root->appendChild($element);
24
25echo "Add second\n";
26$element = $dom->createElementNS('http://example.com/A', 'p', 'Hello World');
27$root->appendChild($element);
28
29echo "Add third\n";
30$element = $dom->createElementNS('http://example.com/A', 'p', 'Hello World');
31$root->appendChild($element);
32
33var_dump($dom->saveXML());
34
35?>
36--EXPECT--
37Add first
38Add second
39Add third
40string(201) "<?xml version="1.0"?>
41<html xmlns="http://www.w3.org/2000/xhtml" xmlns:a="http://example.com/A" xmlns:b="http://example.com/B"><b:p>Hello World</b:p><a:p>Hello World</a:p><a:p>Hello World</a:p></html>
42"
43