xref: /PHP-7.4/ext/simplexml/tests/bug46047.phpt (revision d679f022)
1--TEST--
2Bug #46047 (SimpleXML converts empty nodes into object with nested array)
3--SKIPIF--
4<?php if (!extension_loaded("simplexml")) print "skip"; ?>
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===DONE===
18--EXPECT--
19SimpleXMLElement Object
20(
21    [bar] => SimpleXMLElement Object
22        (
23        )
24
25    [baz] => SimpleXMLElement Object
26        (
27        )
28
29)
30SimpleXMLElement Object
31(
32    [bar] => SimpleXMLElement Object
33        (
34        )
35
36    [baz] => SimpleXMLElement Object
37        (
38        )
39
40)
41SimpleXMLElement Object
42(
43    [bar] => SimpleXMLElement Object
44        (
45        )
46
47    [baz] => SimpleXMLElement Object
48        (
49        )
50
51)
52===DONE===
53
54