summaryrefslogtreecommitdiff
path: root/ext/json
diff options
context:
space:
mode:
authorMáté Kocsis <kocsismate@woohoolabs.com>2020-04-01 23:32:39 +0200
committerMáté Kocsis <kocsismate@woohoolabs.com>2020-04-06 10:41:01 +0200
commit50765075db6b6d5a9597589601c59f743f6ee9c8 (patch)
tree29ef6350004c95c3df9577e47ceaa1458e60921e /ext/json
parent21cfa03f1740042d0c48269430e0490e319e1408 (diff)
downloadphp-git-50765075db6b6d5a9597589601c59f743f6ee9c8.tar.gz
Improve some ValueError messages
Closes GH-5340
Diffstat (limited to 'ext/json')
-rw-r--r--ext/json/json.c4
-rw-r--r--ext/json/tests/bug72787.phpt2
-rw-r--r--ext/json/tests/json_decode_error.phpt2
3 files changed, 4 insertions, 4 deletions
diff --git a/ext/json/json.c b/ext/json/json.c
index b78de3ea16..c64378fd56 100644
--- a/ext/json/json.c
+++ b/ext/json/json.c
@@ -299,12 +299,12 @@ PHP_FUNCTION(json_decode)
}
if (depth <= 0) {
- zend_value_error("Depth must be greater than zero");
+ zend_argument_value_error(3, "must be greater than 0");
RETURN_THROWS();
}
if (depth > INT_MAX) {
- zend_value_error("Depth must be lower than %d", INT_MAX);
+ zend_argument_value_error(3, "must be less than %d", INT_MAX);
RETURN_THROWS();
}
diff --git a/ext/json/tests/bug72787.phpt b/ext/json/tests/bug72787.phpt
index d2d1f80177..48983b0fb7 100644
--- a/ext/json/tests/bug72787.phpt
+++ b/ext/json/tests/bug72787.phpt
@@ -14,4 +14,4 @@ try {
?>
--EXPECTF--
-Depth must be lower than %d
+json_decode(): Argument #3 ($depth) must be less than %d
diff --git a/ext/json/tests/json_decode_error.phpt b/ext/json/tests/json_decode_error.phpt
index b286df8e74..36d86168cd 100644
--- a/ext/json/tests/json_decode_error.phpt
+++ b/ext/json/tests/json_decode_error.phpt
@@ -19,4 +19,4 @@ try {
*** Testing json_decode() : error conditions ***
-- Testing json_decode() function with depth below 0 --
-Depth must be greater than zero
+json_decode(): Argument #3 ($depth) must be greater than 0