xref: /PHP-7.0/ext/simplexml/tests/bug66084_1.phpt (revision 8ca02bb2)
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<?php if (!extension_loaded("json")) print "skip json not available"; ?>
6--FILE--
7<?php
8echo json_encode(simplexml_load_string('<a><b/><c><x/></c></a>')->c), "\n";
9echo json_encode(simplexml_load_string('<a><b/><c><x/></c></a>')), "\n";
10echo json_encode(simplexml_load_string('<a><b/><d/><c><x/></c></a>')), "\n";
11echo json_encode(simplexml_load_string('<a><b/><c><d/><x/></c></a>')), "\n";
12echo json_encode(simplexml_load_string('<a><b/><c><d><x/></d></c></a>')), "\n";
13?>
14--EXPECT--
15{"x":{}}
16{"b":{},"c":{"x":{}}}
17{"b":{},"d":{},"c":{"x":{}}}
18{"b":{},"c":{"d":{},"x":{}}}
19{"b":{},"c":{"d":{"x":{}}}}
20