Annotation of embedaddon/php/ext/json/tests/bug54058.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Bug #54058 (json_last_error() invalid UTF-8 produces wrong error)
! 3: --SKIPIF--
! 4: <?php if (!extension_loaded("json")) print "skip"; ?>
! 5: --FILE--
! 6: <?php
! 7:
! 8: $bad_utf8 = quoted_printable_decode('=B0');
! 9:
! 10: json_encode($bad_utf8);
! 11: var_dump(json_last_error());
! 12:
! 13: $a = new stdclass;
! 14: $a->foo = quoted_printable_decode('=B0');
! 15: json_encode($a);
! 16: var_dump(json_last_error());
! 17:
! 18: $b = new stdclass;
! 19: $b->foo = $bad_utf8;
! 20: $b->bar = 1;
! 21: json_encode($b);
! 22: var_dump(json_last_error());
! 23:
! 24: $c = array(
! 25: 'foo' => $bad_utf8,
! 26: 'bar' => 1
! 27: );
! 28: json_encode($c);
! 29: var_dump(json_last_error());
! 30: ?>
! 31: --EXPECTF--
! 32: int(5)
! 33: int(5)
! 34: int(5)
! 35: int(5)
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>