1--TEST--
2getDocNamespaces() without internal namespace declaration in the document
3--EXTENSIONS--
4simplexml
5dom
6--FILE--
7<?php
8
9$xml = <<<XML
10<root>
11    <child xmlns="urn:a">
12        <a/>
13        <b xmlns=""/>
14        <c xmlns:a="urn:a" xmlns="urn:c"/>
15    </child>
16    <child2 xmlns:d="urn:d"/>
17</root>
18XML;
19
20$sxe = simplexml_load_string($xml);
21var_dump($sxe->getDocNamespaces(true));
22
23$dom = new DOMDocument;
24$dom->loadXML($xml);
25$sxe = simplexml_import_dom($dom);
26var_dump($sxe->getDocNamespaces(true));
27
28$dom = Dom\XMLDocument::createFromString($xml);
29$sxe = simplexml_import_dom($dom);
30var_dump($sxe->getDocNamespaces(true));
31
32?>
33--EXPECT--
34array(3) {
35  [""]=>
36  string(5) "urn:a"
37  ["a"]=>
38  string(5) "urn:a"
39  ["d"]=>
40  string(5) "urn:d"
41}
42array(3) {
43  [""]=>
44  string(5) "urn:a"
45  ["a"]=>
46  string(5) "urn:a"
47  ["d"]=>
48  string(5) "urn:d"
49}
50array(3) {
51  [""]=>
52  string(5) "urn:a"
53  ["a"]=>
54  string(5) "urn:a"
55  ["d"]=>
56  string(5) "urn:d"
57}
58