1
0
mirror of https://github.com/php/php-src.git synced 2026-04-05 23:23:03 +02:00
Files
archived-php-src/ext/json/tests/bug54058.phpt
Nikita Popov b7903f9778 Revert JSON merges to 5.4
This reverts the following merge commits (-m 1):

405ebfcd18
d372b33c9b
36fa17a5fa
2012-07-01 16:38:26 +02:00

36 lines
606 B
PHP

--TEST--
Bug #54058 (json_last_error() invalid UTF-8 produces wrong error)
--SKIPIF--
<?php if (!extension_loaded("json")) print "skip"; ?>
--FILE--
<?php
$bad_utf8 = quoted_printable_decode('=B0');
json_encode($bad_utf8);
var_dump(json_last_error());
$a = new stdclass;
$a->foo = quoted_printable_decode('=B0');
json_encode($a);
var_dump(json_last_error());
$b = new stdclass;
$b->foo = $bad_utf8;
$b->bar = 1;
json_encode($b);
var_dump(json_last_error());
$c = array(
'foo' => $bad_utf8,
'bar' => 1
);
json_encode($c);
var_dump(json_last_error());
?>
--EXPECTF--
int(5)
int(5)
int(5)
int(5)