[php-src] PHP-8.5: Merge branch 'PHP-8.4' into PHP-8.5
| From: | Weilin Du | Date: | Mon, 16 Nov 2026 17:27:31 +0000 |
| Subject: | [php-src] PHP-8.5: Merge branch 'PHP-8.4' into PHP-8.5 | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-143746@lists.php.net to get a copy of this message | ||
Author: Weilin Du (LamentXU123)
Date: 2026-11-17T01:21:19+08:00
Commit: https://github.com/php/php-src/commit/79a4c6021137360c7d37ea4c599291e0c484a631
Raw diff: https://github.com/php/php-src/commit/79a4c6021137360c7d37ea4c599291e0c484a631.diff
Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
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 2456029cfbef..b138439b8f3a 100644
--- a/NEWS
+++ b/NEWS
@@ -46,6 +46,9 @@ PHP NEWS
. Fixed imagecreatefromstring() continuing to decode after throwing for a
string longer than INT_MAX. (lacatoire)
+- 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 0b42187491ff..3ff83e9009ba 100644
--- a/ext/json/json.c
+++ b/ext/json/json.c
@@ -296,7 +296,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();
}
@@ -347,7 +347,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 c08bd18ec9b1..4c2f8d62c5db 100644
--- a/ext/json/tests/bug72787.phpt
+++ b/ext/json/tests/bug72787.phpt
@@ -13,4 +13,4 @@ try {
?>
--EXPECTF--
-json_decode(): Argument #3 ($depth) must be less than %d
+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 cd0545b9a7f9..faad350b4e93 100644
--- a/ext/json/tests/json_validate_003.phpt
+++ b/ext/json/tests/json_validate_003.phpt
@@ -14,6 +14,6 @@ try {
?>
--EXPECTF--
-json_validate(): Argument #2 ($depth) must be less than %d
+json_validate(): Argument #2 ($depth) must be less than or equal to %d
int(0)
string(8) "No error"