@ 2015-03-04T08:23:13Z <?php
$a = '<?xml version="1.0" encoding="UTF-8"?>
<root a="b">
<row b="y">
<item s="t" />
</row>
<row p="c">
<item y="n" />
</row>
</root>';
$simple_xml = @simplexml_load_string($a);
echo "The XML without new lines,tabs\n:";
$b = str_replace( array("\n", "\r", "\t"), "", $a );
echo "The Bug\n:";
$simple_xml = @simplexml_load_string($b);
var_dump($simple_xml);
echo json_encode($simple_xml);
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Output for 5.3.0 - 5.3.29 , 5.5.27 - 5.5.38 , 5.6.11 - 5.6.24 , 7.0.0 - 7.0.20 , 7.1.0 - 7.1.25 , 7.2.0 - 7.2.33 , 7.3.0 - 7.3.33 , 7.4.0 - 7.4.33 , 8.0.0 - 8.0.30 , 8.1.0 - 8.1.28 , 8.2.0 - 8.2.18 , 8.3.0 - 8.3.4 , 8.3.6 The XML without new lines,tabs
:The Bug
:object(SimpleXMLElement)#2 (2) {
["@attributes"]=>
array(1) {
["a"]=>
string(1) "b"
}
["row"]=>
array(2) {
[0]=>
object(SimpleXMLElement)#1 (2) {
["@attributes"]=>
array(1) {
["b"]=>
string(1) "y"
}
["item"]=>
object(SimpleXMLElement)#4 (1) {
["@attributes"]=>
array(1) {
["s"]=>
string(1) "t"
}
}
}
[1]=>
object(SimpleXMLElement)#3 (2) {
["@attributes"]=>
array(1) {
["p"]=>
string(1) "c"
}
["item"]=>
object(SimpleXMLElement)#4 (1) {
["@attributes"]=>
array(1) {
["y"]=>
string(1) "n"
}
}
}
}
}
{"@attributes":{"a":"b"},"row":[{"@attributes":{"b":"y"},"item":{"@attributes":{"s":"t"}}},{"@attributes":{"p":"c"},"item":{"@attributes":{"y":"n"}}}]} Output for 8.3.5 Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
The XML without new lines,tabs
:The Bug
:object(SimpleXMLElement)#2 (2) {
["@attributes"]=>
array(1) {
["a"]=>
string(1) "b"
}
["row"]=>
array(2) {
[0]=>
object(SimpleXMLElement)#1 (2) {
["@attributes"]=>
array(1) {
["b"]=>
string(1) "y"
}
["item"]=>
object(SimpleXMLElement)#4 (1) {
["@attributes"]=>
array(1) {
["s"]=>
string(1) "t"
}
}
}
[1]=>
object(SimpleXMLElement)#3 (2) {
["@attributes"]=>
array(1) {
["p"]=>
string(1) "c"
}
["item"]=>
object(SimpleXMLElement)#4 (1) {
["@attributes"]=>
array(1) {
["y"]=>
string(1) "n"
}
}
}
}
}
{"@attributes":{"a":"b"},"row":[{"@attributes":{"b":"y"},"item":{"@attributes":{"s":"t"}}},{"@attributes":{"p":"c"},"item":{"@attributes":{"y":"n"}}}]} Output for 5.4.28 - 5.4.45 , 5.5.12 - 5.5.26 , 5.6.0 - 5.6.10 The XML without new lines,tabs
:The Bug
:object(SimpleXMLElement)#2 (2) {
["@attributes"]=>
array(1) {
["a"]=>
string(1) "b"
}
["row"]=>
array(2) {
[0]=>
object(SimpleXMLElement)#1 (2) {
["@attributes"]=>
array(1) {
["b"]=>
string(1) "y"
}
[0]=>
object(SimpleXMLElement)#4 (1) {
["@attributes"]=>
array(1) {
["s"]=>
string(1) "t"
}
}
}
[1]=>
object(SimpleXMLElement)#3 (2) {
["@attributes"]=>
array(1) {
["p"]=>
string(1) "c"
}
["item"]=>
object(SimpleXMLElement)#4 (1) {
["@attributes"]=>
array(1) {
["y"]=>
string(1) "n"
}
}
}
}
}
{"@attributes":{"a":"b"},"row":[{"@attributes":{"b":"y"},"0":{"@attributes":{"s":"t"}}},{"@attributes":{"p":"c"},"item":{"@attributes":{"y":"n"}}}]} Output for 5.4.0 - 5.4.27 , 5.5.0 - 5.5.11 The XML without new lines,tabs
:The Bug
:object(SimpleXMLElement)#2 (2) {
["@attributes"]=>
array(1) {
["a"]=>
string(1) "b"
}
["row"]=>
array(2) {
[0]=>
object(SimpleXMLElement)#1 (2) {
["@attributes"]=>
array(1) {
["b"]=>
string(1) "y"
}
[0]=>
object(SimpleXMLElement)#4 (1) {
["@attributes"]=>
array(1) {
["s"]=>
string(1) "t"
}
}
}
[1]=>
object(SimpleXMLElement)#3 (2) {
["@attributes"]=>
array(1) {
["p"]=>
string(1) "c"
}
[0]=>
object(SimpleXMLElement)#4 (1) {
["@attributes"]=>
array(1) {
["y"]=>
string(1) "n"
}
}
}
}
}
{"@attributes":{"a":"b"},"row":[{"@attributes":{"b":"y"},"0":{"@attributes":{"s":"t"}}},{"@attributes":{"p":"c"},"0":{"@attributes":{"y":"n"}}}]} Output for 5.2.0 - 5.2.17 The XML without new lines,tabs
:The Bug
:object(SimpleXMLElement)#2 (2) {
["@attributes"]=>
array(1) {
["a"]=>
string(1) "b"
}
["row"]=>
array(2) {
[0]=>
object(SimpleXMLElement)#1 (2) {
["@attributes"]=>
array(1) {
["b"]=>
string(1) "y"
}
["item"]=>
object(SimpleXMLElement)#4 (1) {
["@attributes"]=>
array(1) {
["s"]=>
string(1) "t"
}
}
}
[1]=>
object(SimpleXMLElement)#3 (2) {
["@attributes"]=>
array(1) {
["p"]=>
string(1) "c"
}
["item"]=>
object(SimpleXMLElement)#5 (1) {
["@attributes"]=>
array(1) {
["y"]=>
string(1) "n"
}
}
}
}
}
{"@attributes":{"a":"b"},"row":[{"@attributes":{"b":"y"},"item":{"@attributes":{"s":"t"}}},{"@attributes":{"p":"c"},"item":{"@attributes":{"y":"n"}}}]} Output for 5.1.2 - 5.1.6 The XML without new lines,tabs
:The Bug
:object(SimpleXMLElement)#2 (2) {
["@attributes"]=>
array(1) {
["a"]=>
string(1) "b"
}
["row"]=>
array(2) {
[0]=>
object(SimpleXMLElement)#1 (2) {
["@attributes"]=>
array(1) {
["b"]=>
string(1) "y"
}
["item"]=>
object(SimpleXMLElement)#4 (1) {
["@attributes"]=>
array(1) {
["s"]=>
string(1) "t"
}
}
}
[1]=>
object(SimpleXMLElement)#3 (2) {
["@attributes"]=>
array(1) {
["p"]=>
string(1) "c"
}
["item"]=>
object(SimpleXMLElement)#5 (1) {
["@attributes"]=>
array(1) {
["y"]=>
string(1) "n"
}
}
}
}
}
Fatal error: Call to undefined function json_encode() in /in/RUnot on line 22
Process exited with code 255 . Output for 5.0.0 - 5.0.5 , 5.1.0 - 5.1.1 The XML without new lines,tabs
:The Bug
:object(SimpleXMLElement)#2 (1) {
["row"]=>
array(2) {
[0]=>
object(SimpleXMLElement)#1 (1) {
["item"]=>
object(SimpleXMLElement)#4 (0) {
}
}
[1]=>
object(SimpleXMLElement)#3 (1) {
["item"]=>
object(SimpleXMLElement)#5 (0) {
}
}
}
}
Fatal error: Call to undefined function json_encode() in /in/RUnot on line 22
Process exited with code 255 . Output for 4.3.2 - 4.3.11 , 4.4.0 - 4.4.9 Process exited with code 255 . Output for 4.3.0 - 4.3.1 preferences:dark mode live preview
244.26 ms | 401 KiB | 366 Q