xref: /PHP-8.0/ext/simplexml/tests/bug69169.phpt (revision f8d79582)
1--TEST--
2Bug #69169 (simplexml_load_string parse wrongly when xml given in one row)
3--SKIPIF--
4<?php
5if (!extension_loaded("simplexml")) die("skip SimpleXML not available");
6?>
7--FILE--
8<?php
9$a = '<?xml version="1.0" encoding="UTF-8"?>
10<root a="b">
11    <row b="y">
12        <item s="t" />
13    </row>
14    <row p="c">
15        <item y="n" />
16    </row>
17</root>';
18$b = str_replace(array("\n", "\r", "\t"), "", $a);
19$simple_xml = simplexml_load_string($b);
20print_r($simple_xml);
21?>
22--EXPECT--
23SimpleXMLElement Object
24(
25    [@attributes] => Array
26        (
27            [a] => b
28        )
29
30    [row] => Array
31        (
32            [0] => SimpleXMLElement Object
33                (
34                    [@attributes] => Array
35                        (
36                            [b] => y
37                        )
38
39                    [item] => SimpleXMLElement Object
40                        (
41                            [@attributes] => Array
42                                (
43                                    [s] => t
44                                )
45
46                        )
47
48                )
49
50            [1] => SimpleXMLElement Object
51                (
52                    [@attributes] => Array
53                        (
54                            [p] => c
55                        )
56
57                    [item] => SimpleXMLElement Object
58                        (
59                            [@attributes] => Array
60                                (
61                                    [y] => n
62                                )
63
64                        )
65
66                )
67
68        )
69
70)
71