mirror of
https://github.com/php/php-src.git
synced 2024-09-29 05:46:06 +00:00
f30503ce4e
This fixes differences in error codes with PHP 5 and 7. The malformed UTF-8 and control character error codes are now returned even in non-string context which makes it the same as it was in PHP 5 json ext.
50 lines
825 B
PHP
50 lines
825 B
PHP
--TEST--
|
|
Bug #69187 json_last_error return BC in PHP7
|
|
--SKIPIF--
|
|
<?php if (!extension_loaded("json")) print "skip"; ?>
|
|
--FILE--
|
|
<?php
|
|
var_dump(json_decode(NULL));
|
|
var_dump(json_last_error());
|
|
var_dump(json_decode(FALSE));
|
|
var_dump(json_last_error());
|
|
var_dump(json_decode(""));
|
|
var_dump(json_last_error());
|
|
|
|
var_dump(json_decode(0));
|
|
var_dump(json_last_error());
|
|
var_dump(json_decode(1));
|
|
var_dump(json_last_error());
|
|
var_dump(json_decode(TRUE));
|
|
var_dump(json_last_error());
|
|
|
|
json_decode("\xED\xA0\xB4");
|
|
var_dump(json_last_error());
|
|
|
|
json_decode("\x00");
|
|
var_dump(json_last_error());
|
|
|
|
json_decode("\"\xED\xA0\xB4\"");
|
|
var_dump(json_last_error());
|
|
|
|
json_decode("\"\x00\"");
|
|
var_dump(json_last_error());
|
|
?>
|
|
--EXPECT--
|
|
NULL
|
|
int(4)
|
|
NULL
|
|
int(4)
|
|
NULL
|
|
int(4)
|
|
int(0)
|
|
int(0)
|
|
int(1)
|
|
int(0)
|
|
int(1)
|
|
int(0)
|
|
int(5)
|
|
int(3)
|
|
int(5)
|
|
int(3)
|