json_decode() returns a binary string, not unicode for
efficiency, and if you are going to test invalid utf8
in a test, you have to stuff it into a binary string
or it will be valid unicode by definition.
?>
--EXPECTF--
Deprecated: setlocale(): deprecated in Unicode mode, please use ICU locale functions in %s on line %d
-unicode(13) "[100.1,"bar"]"
-unicode(21) "{"a":100.1,"b":"foo"}"
+string(13) "[100.1,"bar"]"
+string(21) "{"a":100.1,"b":"foo"}"
--FILE--
<?php
-var_dump(json_encode("abc"));
-var_dump(json_encode("ab\xE0"));
-var_dump(json_encode("ab\xE0c"));
-var_dump(json_encode(array("ab\xE0", "ab\xE0c", "abc")));
+var_dump(json_encode(b"abc"));
+var_dump(json_encode(b"ab\xE0"));
+var_dump(json_encode(b"ab\xE0c"));
+var_dump(json_encode(array(b"ab\xE0", b"ab\xE0c", b"abc")));
echo "Done\n";
?>