Add tests for `json_decode` with depth below 0
authorNat Zimmermann <nat@ntzm.io>
Mon, 15 Jan 2018 23:06:55 +0000 (23:06 +0000)
committerNikita Popov <nikita.ppv@gmail.com>
Wed, 24 Jan 2018 20:23:24 +0000 (21:23 +0100)
ext/json/tests/json_decode_error.phpt

index 90a42889a038b1f7c55a8110717a48976eed78fb..9906a2b0d4d90024143a7a3121696ec2561f1960 100644 (file)
@@ -13,6 +13,9 @@ echo "\n-- Testing json_decode() function with more than expected no. of argumen
 $extra_arg = 10;
 var_dump(json_decode('"abc"', true, 512, 0, $extra_arg));
 
+echo "\n-- Testing json_decode() function with depth below 0 --\n";
+var_dump(json_decode('"abc"', true, -1));
+
 ?>
 ===Done===
 --EXPECTF--
@@ -27,4 +30,9 @@ NULL
 
 Warning: json_decode() expects at most 4 parameters, 5 given in %s on line %d
 NULL
+
+-- Testing json_decode() function with depth below 0 --
+
+Warning: json_decode(): Depth must be greater than zero in %s on line %d
+NULL
 ===Done===