Skip to content

Commit 2d1ec6f

Browse files
ntzmnikic
authored andcommitted
Add tests for json_decode with depth below 0
1 parent 2687be6 commit 2d1ec6f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

ext/json/tests/json_decode_error.phpt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ echo "\n-- Testing json_decode() function with more than expected no. of argumen
1313
$extra_arg = 10;
1414
var_dump(json_decode('"abc"', true, 512, 0, $extra_arg));
1515

16+
echo "\n-- Testing json_decode() function with depth below 0 --\n";
17+
var_dump(json_decode('"abc"', true, -1));
18+
1619
?>
1720
===Done===
1821
--EXPECTF--
@@ -27,4 +30,9 @@ NULL
2730

2831
Warning: json_decode() expects at most 4 parameters, 5 given in %s on line %d
2932
NULL
33+
34+
-- Testing json_decode() function with depth below 0 --
35+
36+
Warning: json_decode(): Depth must be greater than zero in %s on line %d
37+
NULL
3038
===Done===

0 commit comments

Comments
 (0)