1--TEST-- 2json_last_error() tests 3--SKIPIF-- 4<?php if (!extension_loaded("json")) print "skip"; ?> 5--FILE-- 6<?php 7var_dump(json_decode("[1]")); 8var_dump(json_last_error()); 9var_dump(json_decode("[[1]]", false, 2)); 10var_dump(json_last_error()); 11var_dump(json_decode("[1}")); 12var_dump(json_last_error()); 13var_dump(json_decode('["' . chr(0) . 'abcd"]')); 14var_dump(json_last_error()); 15var_dump(json_decode("[1")); 16var_dump(json_last_error()); 17 18 19echo "Done\n"; 20?> 21--EXPECT-- 22array(1) { 23 [0]=> 24 int(1) 25} 26int(0) 27NULL 28int(1) 29NULL 30int(2) 31NULL 32int(3) 33NULL 34int(4) 35Done 36 37