[php-src] PHP-8.6: Merge branch 'PHP-8.5' into PHP-8.6
| From: | Weilin Du | Date: | Mon, 16 Nov 2026 17:27:32 +0000 |
| Subject: | [php-src] PHP-8.6: Merge branch 'PHP-8.5' into PHP-8.6 | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-143744@lists.php.net to get a copy of this message | ||
Author: Weilin Du (LamentXU123)
Date: 2026-11-17T01:21:50+08:00
Commit: https://github.com/php/php-src/commit/e9ac0d54b4a0f43a40ff4aa08d27f7729509da1f
Raw diff: https://github.com/php/php-src/commit/e9ac0d54b4a0f43a40ff4aa08d27f7729509da1f.diff
Merge branch 'PHP-8.5' into PHP-8.6
* PHP-8.5:
Fix json_decode() and json_validate() depth upper bound messages (#25468)
Changed paths:
M NEWS
M ext/json/json.c
M ext/json/tests/bug72787.phpt
M ext/json/tests/json_validate_003.phpt
Diff:
diff --git a/NEWS b/NEWS
index cca27c2d71cf..2c19cee1f86e 100644
--- a/NEWS
+++ b/NEWS
@@ -65,6 +65,9 @@ PHP NEWS
setAttribute() accepting out-of-range values that truncate to a valid one.
(Jorg Sowa)
+- JSON:
+ . Fixed json_decode() and json_validate() error messages. (lacatoire)
+
- MBString:
. Fixed stack overflow in mb_check_encoding() and mb_convert_encoding() with
deeply nested arrays. (Eyüp Can Akman)
diff --git a/ext/json/json.c b/ext/json/json.c
index b71b9aafe997..48be47f5587a 100644
--- a/ext/json/json.c
+++ b/ext/json/json.c
@@ -323,7 +323,7 @@ PHP_FUNCTION(json_decode)
}
if (depth > INT_MAX) {
- zend_argument_value_error(3, "must be less than %d", INT_MAX);
+ zend_argument_value_error(3, "must be less than or equal to %d", INT_MAX);
RETURN_THROWS();
}
@@ -379,7 +379,7 @@ PHP_FUNCTION(json_validate)
}
if (depth > INT_MAX) {
- zend_argument_value_error(2, "must be less than %d", INT_MAX);
+ zend_argument_value_error(2, "must be less than or equal to %d", INT_MAX);
RETURN_THROWS();
}
diff --git a/ext/json/tests/bug72787.phpt b/ext/json/tests/bug72787.phpt
index 637c22014f42..f2541b3225c4 100644
--- a/ext/json/tests/bug72787.phpt
+++ b/ext/json/tests/bug72787.phpt
@@ -13,4 +13,4 @@ try {
?>
--EXPECTF--
-ValueError: json_decode(): Argument #3 ($depth) must be less than %d
+ValueError: json_decode(): Argument #3 ($depth) must be less than or equal to %d
diff --git a/ext/json/tests/json_validate_003.phpt b/ext/json/tests/json_validate_003.phpt
index e538ed72ee61..c3797c756fbe 100644
--- a/ext/json/tests/json_validate_003.phpt
+++ b/ext/json/tests/json_validate_003.phpt
@@ -14,6 +14,6 @@ try {
?>
--EXPECTF--
-ValueError: json_validate(): Argument #2 ($depth) must be less than %d
+ValueError: json_validate(): Argument #2 ($depth) must be less than or equal to %d
int(0)
string(8) "No error"