summaryrefslogtreecommitdiff
path: root/ext/json
diff options
context:
space:
mode:
authorNat Zimmermann <nat@ntzm.io>2018-01-15 23:06:55 +0000
committerNikita Popov <nikita.ppv@gmail.com>2018-01-24 21:23:24 +0100
commit2d1ec6f4b57e7c192b124dc1a59161f39e33077f (patch)
tree40be0e1d951e7cb37c1476787431a9721ec55c98 /ext/json
parent2687be6589996b1af9d39c7a02d56cadab009a1c (diff)
downloadphp-git-2d1ec6f4b57e7c192b124dc1a59161f39e33077f.tar.gz
Add tests for `json_decode` with depth below 0
Diffstat (limited to 'ext/json')
-rw-r--r--ext/json/tests/json_decode_error.phpt8
1 files changed, 8 insertions, 0 deletions
diff --git a/ext/json/tests/json_decode_error.phpt b/ext/json/tests/json_decode_error.phpt
index 90a42889a0..9906a2b0d4 100644
--- a/ext/json/tests/json_decode_error.phpt
+++ b/ext/json/tests/json_decode_error.phpt
@@ -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===