xref: /PHP-8.4/ext/simplexml/tests/bug46047.phpt (revision 7f2f0c00)
1--TEST--
2Bug #46047 (SimpleXML converts empty nodes into object with nested array)
3--EXTENSIONS--
4simplexml
5--FILE--
6<?php
7$xml = new SimpleXMLElement('<foo><bar><![CDATA[]]></bar><baz/></foo>',
8  LIBXML_NOCDATA);
9print_r($xml);
10
11$xml = new SimpleXMLElement('<foo><bar></bar><baz/></foo>');
12print_r($xml);
13
14$xml = new SimpleXMLElement('<foo><bar/><baz/></foo>');
15print_r($xml);
16?>
17--EXPECT--
18SimpleXMLElement Object
19(
20    [bar] => SimpleXMLElement Object
21        (
22        )
23
24    [baz] => SimpleXMLElement Object
25        (
26        )
27
28)
29SimpleXMLElement Object
30(
31    [bar] => SimpleXMLElement Object
32        (
33        )
34
35    [baz] => SimpleXMLElement Object
36        (
37        )
38
39)
40SimpleXMLElement Object
41(
42    [bar] => SimpleXMLElement Object
43        (
44        )
45
46    [baz] => SimpleXMLElement Object
47        (
48        )
49
50)
51
52