1--TEST-- 2Test json_decode() function : error conditions 3--SKIPIF-- 4<?php if (!extension_loaded("json")) print "skip"; ?> 5--FILE-- 6<?php 7echo "*** Testing json_decode() : error conditions ***\n"; 8 9echo "\n-- Testing json_decode() function with no arguments --\n"; 10var_dump(json_decode()); 11 12echo "\n-- Testing json_decode() function with more than expected no. of arguments --\n"; 13$extra_arg = 10; 14var_dump(json_decode('"abc"', true, 512, 0, $extra_arg)); 15 16echo "\n-- Testing json_decode() function with depth below 0 --\n"; 17var_dump(json_decode('"abc"', true, -1)); 18 19?> 20===Done=== 21--EXPECTF-- 22*** Testing json_decode() : error conditions *** 23 24-- Testing json_decode() function with no arguments -- 25 26Warning: json_decode() expects at least 1 parameter, 0 given in %s on line %d 27NULL 28 29-- Testing json_decode() function with more than expected no. of arguments -- 30 31Warning: json_decode() expects at most 4 parameters, 5 given in %s on line %d 32NULL 33 34-- Testing json_decode() function with depth below 0 -- 35 36Warning: json_decode(): Depth must be greater than zero in %s on line %d 37NULL 38===Done=== 39