1
0
mirror of https://github.com/php/php-src.git synced 2026-03-26 01:02:25 +01:00
Files
archived-php-src/ext/json/tests/bug43941.phpt
Rasmus Lerdorf 4743436576 Fix 2 broken json tests.
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.
2009-07-26 07:21:02 +00:00

21 lines
410 B
PHP

--TEST--
Bug #43941 (json_encode() invalid UTF-8)
--SKIPIF--
<?php if (!extension_loaded("json")) print "skip"; ?>
--FILE--
<?php
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";
?>
--EXPECT--
string(5) ""abc""
string(4) "null"
string(4) "null"
string(17) "[null,null,"abc"]"
Done