summaryrefslogtreecommitdiff
path: root/ext/simplexml/tests/bug62639.phpt
blob: 4a4e157b76f3750ce04feaecfd220e6be6f27f4b (plain)
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
--TEST--
Bug #62639 (XML structure broken)
--SKIPIF--
<?php
if (!extension_loaded("simplexml")) die("skip SimpleXML not available");
?>
--FILE--
<?php

class A extends SimpleXMLElement
{
}

$xml1 = <<<XML
<?xml version="1.0"?>
<a>
    <b>
        <c>
            <value attr="Some Attr">Some Value</value>
        </c>
    </b>
</a>
XML;

$a1 = new A($xml1);

foreach ($a1->b->c->children() as $key => $value) {
    var_dump($value);
}

$xml2 = <<<XML
<?xml version="1.0"?>
<a>
    <b>
        <c><value attr="Some Attr">Some Value</value></c>
    </b>
</a>
XML;

$a2 = new A($xml2);

foreach ($a2->b->c->children() as $key => $value) {
    var_dump($value);
}?>
--EXPECT--
object(A)#2 (2) {
  ["@attributes"]=>
  array(1) {
    ["attr"]=>
    string(9) "Some Attr"
  }
  [0]=>
  string(10) "Some Value"
}
object(A)#3 (2) {
  ["@attributes"]=>
  array(1) {
    ["attr"]=>
    string(9) "Some Attr"
  }
  [0]=>
  string(10) "Some Value"
}