Revision df595a9fb894 () - Diff

Link to this snippet: https://friendpaste.com/1BnWr4haCmIoRsscY9fpWt
Embed:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
--TEST--
json_decode() function - a test to verify that json_decode() returns NULL on an invalid json string
--SKIPIF--
<?php if (!function_exists('json')) echo "SKIP"; ?>
--FILE--
<?php
/**
* All values were verified to be invalid JSON on jsonlint.com.
*
* Therefor, json_encode() should return NULL on those values as noted in the documentation.
*
* @link http://bugs.php.net/bug.php?id=45989
*/
var_dump(json_decode("'invalid json'"));
var_dump(json_decode('invalid json'));
var_dump(json_decode(' {'));
var_dump(json_decode(' ['));
?>
--EXPECT--
NULL
NULL
NULL
NULL