[php-src] PHP-8.6: Merge branch 'PHP-8.4' into PHP-8.5
| From: | David Carlier | Date: | Fri, 20 Nov 2026 15:47:36 +0000 |
| Subject: | [php-src] PHP-8.6: Merge branch 'PHP-8.4' into PHP-8.5 | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-143971@lists.php.net to get a copy of this message | ||
Author: David Carlier (devnexen)
Date: 2026-11-20T15:46:04Z
Commit: https://github.com/php/php-src/commit/54c663789ba96c5d40cd8da8756782781d613aec
Raw diff: https://github.com/php/php-src/commit/54c663789ba96c5d40cd8da8756782781d613aec.diff
Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
ext/intl: Fix intl_error_name() truncating codes outside the int range
Changed paths:
A ext/intl/tests/intl_error_name_out_of_range.phpt
M ext/intl/common/common_error.c
Diff:
diff --git a/ext/intl/common/common_error.c b/ext/intl/common/common_error.c
index 733a1913ad08..45b49519914b 100644
--- a/ext/intl/common/common_error.c
+++ b/ext/intl/common/common_error.c
@@ -65,6 +65,10 @@ PHP_FUNCTION( intl_error_name )
Z_PARAM_LONG(err_code)
ZEND_PARSE_PARAMETERS_END();
+ if (err_code < INT32_MIN || err_code > INT32_MAX) {
+ err_code = INT32_MAX;
+ }
+
RETURN_STRING( (char*)u_errorName( err_code ) );
}
/* }}} */
diff --git a/ext/intl/tests/intl_error_name_out_of_range.phpt
b/ext/intl/tests/intl_error_name_out_of_range.phpt
new file mode 100644
index 000000000000..4b1d0834c6a0
--- /dev/null
+++ b/ext/intl/tests/intl_error_name_out_of_range.phpt
@@ -0,0 +1,20 @@
+--TEST--
+intl_error_name(): a code outside the int range is not truncated
+--EXTENSIONS--
+intl
+--FILE--
+<?php
+var_dump(intl_error_name(2**32));
+var_dump(intl_error_name(2**32 + 1));
+var_dump(intl_error_name(-(2**32) + 1));
+var_dump(intl_error_name(PHP_INT_MIN));
+var_dump(intl_error_name(2**31));
+var_dump(intl_error_name(0));
+?>
+--EXPECT--
+string(18) "[BOGUS UErrorCode]"
+string(18) "[BOGUS UErrorCode]"
+string(18) "[BOGUS UErrorCode]"
+string(18) "[BOGUS UErrorCode]"
+string(18) "[BOGUS UErrorCode]"
+string(12) "U_ZERO_ERROR"