xref: /PHP-8.0/ext/simplexml/tests/bug66084_1.phpt (revision 32a1ebbd)
1--TEST--
2Bug #66084 simplexml_load_string() mangles empty node name, json variant
3--SKIPIF--
4<?php if (!extension_loaded("simplexml")) print "skip simplexml not available"; ?>
5--FILE--
6<?php
7echo json_encode(simplexml_load_string('<a><b/><c><x/></c></a>')->c), "\n";
8echo json_encode(simplexml_load_string('<a><b/><c><x/></c></a>')), "\n";
9echo json_encode(simplexml_load_string('<a><b/><d/><c><x/></c></a>')), "\n";
10echo json_encode(simplexml_load_string('<a><b/><c><d/><x/></c></a>')), "\n";
11echo json_encode(simplexml_load_string('<a><b/><c><d><x/></d></c></a>')), "\n";
12?>
13--EXPECT--
14{"x":{}}
15{"b":{},"c":{"x":{}}}
16{"b":{},"d":{},"c":{"x":{}}}
17{"b":{},"c":{"d":{},"x":{}}}
18{"b":{},"c":{"d":{"x":{}}}}
19