[php-src] master: Merge branch 'PHP-8.6'

From: Date: Fri, 20 Nov 2026 15:47:39 +0000
Subject: [php-src] master: Merge branch 'PHP-8.6'
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-143974@lists.php.net to get a copy of this message
Author: David Carlier (devnexen) Date: 2026-11-20T15:46:24Z Commit: https://github.com/php/php-src/commit/a91ac223a25bfab3ab4d9670614630100d005668 Raw diff: https://github.com/php/php-src/commit/a91ac223a25bfab3ab4d9670614630100d005668.diff Merge branch 'PHP-8.6' * PHP-8.6: 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.cpp Diff: diff --git a/ext/intl/common/common_error.cpp b/ext/intl/common/common_error.cpp index 7938cbd1dff9..eade5a2ffbd8 100644 --- a/ext/intl/common/common_error.cpp +++ b/ext/intl/common/common_error.cpp @@ -65,6 +65,10 @@ U_CFUNC 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( static_cast<UErrorCode>(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"

« previous php.cvs (#143974) next »