xref: /PHP-8.3/ext/simplexml/tests/bug66084_1.phpt (revision 7f2f0c00)
1--TEST--
2Bug #66084 simplexml_load_string() mangles empty node name, json variant
3--EXTENSIONS--
4simplexml
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