1--TEST--
2Bug #55218 getDocNamespaces from current element and not root
3--EXTENSIONS--
4simplexml
5--FILE--
6<?php
7
8$x = new SimpleXMLElement(
9'<?xml version="1.0" standalone="yes"?>
10<people xmlns:p="http://example.org/p" >
11    <person id="1" xmlns:t="http://example.org/t" >
12                <t:name>John Doe</t:name>
13        </person>
14    <person id="2">Susie Q. Public</person>
15    <o>
16                <p:div>jdslkfjsldk jskdfjsmlkjfkldjkjflskj kljfslkjf sldk</p:div>
17        </o>
18</people>');
19
20echo "getDocNamespaces\n";
21echo "\nBackwards Compatibility:\n";
22echo "recursion:\n";
23
24var_dump ( $x->getDocNamespaces(true) ) ;
25var_dump( $x->person[0]->getDocNamespaces(true) );
26var_dump( $x->person[1]->getDocNamespaces(true) );
27
28echo "\nnon recursive:\n";
29
30var_dump( $x->getDocNamespaces(false) );
31var_dump( $x->person[0]->getDocNamespaces(false) );
32var_dump( $x->person[1]->getDocNamespaces(false) );
33
34echo "\n\nUsing new 'from_root' bool set to false:\n";
35echo "recursion:\n";
36
37var_dump ( $x->getDocNamespaces(true, false) ) ;
38var_dump( $x->person[0]->getDocNamespaces(true, false) );
39var_dump( $x->person[1]->getDocNamespaces(true, false) );
40
41echo "\nnon recursive:\n";
42
43var_dump( $x->getDocNamespaces(false, false) );
44var_dump( $x->person[0]->getDocNamespaces(false, false) );
45var_dump( $x->person[1]->getDocNamespaces(false, false) );
46
47?>
48--EXPECT--
49getDocNamespaces
50
51Backwards Compatibility:
52recursion:
53array(2) {
54  ["p"]=>
55  string(20) "http://example.org/p"
56  ["t"]=>
57  string(20) "http://example.org/t"
58}
59array(2) {
60  ["p"]=>
61  string(20) "http://example.org/p"
62  ["t"]=>
63  string(20) "http://example.org/t"
64}
65array(2) {
66  ["p"]=>
67  string(20) "http://example.org/p"
68  ["t"]=>
69  string(20) "http://example.org/t"
70}
71
72non recursive:
73array(1) {
74  ["p"]=>
75  string(20) "http://example.org/p"
76}
77array(1) {
78  ["p"]=>
79  string(20) "http://example.org/p"
80}
81array(1) {
82  ["p"]=>
83  string(20) "http://example.org/p"
84}
85
86
87Using new 'from_root' bool set to false:
88recursion:
89array(2) {
90  ["p"]=>
91  string(20) "http://example.org/p"
92  ["t"]=>
93  string(20) "http://example.org/t"
94}
95array(1) {
96  ["t"]=>
97  string(20) "http://example.org/t"
98}
99array(0) {
100}
101
102non recursive:
103array(1) {
104  ["p"]=>
105  string(20) "http://example.org/p"
106}
107array(1) {
108  ["t"]=>
109  string(20) "http://example.org/t"
110}
111array(0) {
112}
113