Commit d5facaf8876 for php

commit d5facaf88761737052beca2c988f33e16faa6f97
Author: lacatoire <la.catoire@gmail.com>
Date:   Tue Nov 17 01:19:13 2026 +0800

    Fix json_decode() and json_validate() depth upper bound messages (#25468)

    Both functions accept a depth of INT_MAX, but rejected larger values with
    "must be less than 2147483647". Report "less than or equal to" instead
    so the error messages describe the inclusive upper bound correctly.

    Update the corresponding test expectations.

    Closes #25468

diff --git a/NEWS b/NEWS
index a6555ac871c..d98e18da8d4 100644
--- a/NEWS
+++ b/NEWS
@@ -176,6 +176,7 @@ PHP                                                                        NEWS
     INT_MIN. (Marc Bennewitz)

 - JSON:
+  . Fixed json_decode() and json_validate() error messages. (lacatoire)
   . Fixed json_encode() leaving the recursion guard set on objects with hooked
     properties after running out of memory while escaping a property name.
     (adapik)
diff --git a/ext/json/json.c b/ext/json/json.c
index 0b42187491f..3ff83e9009b 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 c08bd18ec9b..4c2f8d62c5d 100644
--- a/ext/json/tests/bug72787.phpt
+++ b/ext/json/tests/bug72787.phpt
@@ -13,4 +13,4 @@

 ?>
 --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 cd0545b9a7f..faad350b4e9 100644
--- a/ext/json/tests/json_validate_003.phpt
+++ b/ext/json/tests/json_validate_003.phpt
@@ -14,6 +14,6 @@

 ?>
 --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"