File: feature55218.phpt

package info (click to toggle)
php8.2 8.2.29-1~deb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 209,600 kB
  • sloc: ansic: 736,658; php: 33,046; sh: 11,432; cpp: 7,005; pascal: 4,448; javascript: 3,112; asm: 2,404; yacc: 2,222; xml: 1,784; makefile: 689; awk: 148
file content (112 lines) | stat: -rw-r--r-- 2,290 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
--TEST--
Bug #55218 getDocNamespaces from current element and not root
--EXTENSIONS--
simplexml
--FILE--
<?php

$x = new SimpleXMLElement(
'<?xml version="1.0" standalone="yes"?>
<people xmlns:p="http://example.org/p" >
    <person id="1" xmlns:t="http://example.org/t" >
                <t:name>John Doe</t:name>
        </person>
    <person id="2">Susie Q. Public</person>
    <o>
                <p:div>jdslkfjsldk jskdfjsmlkjfkldjkjflskj kljfslkjf sldk</p:div>
        </o>
</people>');

echo "getDocNamespaces\n";
echo "\nBackwards Compatibility:\n";
echo "recursion:\n";

var_dump ( $x->getDocNamespaces(true) ) ;
var_dump( $x->person[0]->getDocNamespaces(true) );
var_dump( $x->person[1]->getDocNamespaces(true) );

echo "\nnon recursive:\n";

var_dump( $x->getDocNamespaces(false) );
var_dump( $x->person[0]->getDocNamespaces(false) );
var_dump( $x->person[1]->getDocNamespaces(false) );

echo "\n\nUsing new 'from_root' bool set to false:\n";
echo "recursion:\n";

var_dump ( $x->getDocNamespaces(true, false) ) ;
var_dump( $x->person[0]->getDocNamespaces(true, false) );
var_dump( $x->person[1]->getDocNamespaces(true, false) );

echo "\nnon recursive:\n";

var_dump( $x->getDocNamespaces(false, false) );
var_dump( $x->person[0]->getDocNamespaces(false, false) );
var_dump( $x->person[1]->getDocNamespaces(false, false) );

?>
--EXPECT--
getDocNamespaces

Backwards Compatibility:
recursion:
array(2) {
  ["p"]=>
  string(20) "http://example.org/p"
  ["t"]=>
  string(20) "http://example.org/t"
}
array(2) {
  ["p"]=>
  string(20) "http://example.org/p"
  ["t"]=>
  string(20) "http://example.org/t"
}
array(2) {
  ["p"]=>
  string(20) "http://example.org/p"
  ["t"]=>
  string(20) "http://example.org/t"
}

non recursive:
array(1) {
  ["p"]=>
  string(20) "http://example.org/p"
}
array(1) {
  ["p"]=>
  string(20) "http://example.org/p"
}
array(1) {
  ["p"]=>
  string(20) "http://example.org/p"
}


Using new 'from_root' bool set to false:
recursion:
array(2) {
  ["p"]=>
  string(20) "http://example.org/p"
  ["t"]=>
  string(20) "http://example.org/t"
}
array(1) {
  ["t"]=>
  string(20) "http://example.org/t"
}
array(0) {
}

non recursive:
array(1) {
  ["p"]=>
  string(20) "http://example.org/p"
}
array(1) {
  ["t"]=>
  string(20) "http://example.org/t"
}
array(0) {
}