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

From: Date: Sat, 01 Aug 2026 16:20:01 +0000
Subject: [php-src] master: Merge branch 'PHP-8.5'
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-140406@lists.php.net to get a copy of this message
Author: Weilin Du (LamentXU123) Date: 2026-08-02T00:17:25+08:00 Commit: https://github.com/php/php-src/commit/198bf7f0be486e27bdb1cb81986a4498e33a09d0 Raw diff: https://github.com/php/php-src/commit/198bf7f0be486e27bdb1cb81986a4498e33a09d0.diff Merge branch 'PHP-8.5' * PHP-8.5: ext/intl: Reset IntlListFormatter error state in constructor (#22931) Changed paths: A ext/intl/tests/listformatter/listformatter_constructor_error_reset.phpt M NEWS M ext/intl/listformatter/listformatter_class.cpp Diff: diff --git a/NEWS b/NEWS index ad511d6a890e..0d5b6300fc7a 100644 --- a/NEWS +++ b/NEWS @@ -12,6 +12,8 @@ PHP NEWS collator_asort() to report UTF-8/UTF-16 conversion errors through the intl error handler instead of emitting a warning and continuing with an empty string. (Weilin Du) + . Fixed IntlListFormatter::__construct() leaving stale global error state + after successful calls. (Weilin Du) - Reflection: . Added ReflectionAttribute::inNamespace(), diff --git a/ext/intl/listformatter/listformatter_class.cpp b/ext/intl/listformatter/listformatter_class.cpp index 59c01259227d..87b5efb3f668 100644 --- a/ext/intl/listformatter/listformatter_class.cpp +++ b/ext/intl/listformatter/listformatter_class.cpp @@ -67,6 +67,9 @@ PHP_METHOD(IntlListFormatter, __construct) zend_long type = INTL_LISTFORMATTER_FALLBACK_TYPE_AND; zend_long width = INTL_LISTFORMATTER_FALLBACK_WIDTH_WIDE; #endif + + intl_errors_reset(LISTFORMATTER_ERROR_P(obj)); + ZEND_PARSE_PARAMETERS_START(1, 3) Z_PARAM_STRING(locale, locale_len) Z_PARAM_OPTIONAL diff --git a/ext/intl/tests/listformatter/listformatter_constructor_error_reset.phpt b/ext/intl/tests/listformatter/listformatter_constructor_error_reset.phpt new file mode 100644 index 000000000000..3360bb848fa6 --- /dev/null +++ b/ext/intl/tests/listformatter/listformatter_constructor_error_reset.phpt @@ -0,0 +1,23 @@ +--TEST-- +IntlListFormatter::__construct() resets stale errors +--EXTENSIONS-- +intl +--FILE-- +<?php +$formatter = new IntlListFormatter('en_US'); +var_dump($formatter->format(["\x80"])); +var_dump(intl_get_error_code() === U_INVALID_CHAR_FOUND); + +$formatter = new IntlListFormatter('en_US'); +var_dump(intl_get_error_code()); +var_dump(intl_get_error_message()); +var_dump($formatter->getErrorCode()); +var_dump($formatter->getErrorMessage()); +?> +--EXPECT-- +bool(false) +bool(true) +int(0) +string(12) "U_ZERO_ERROR" +int(0) +string(12) "U_ZERO_ERROR"

« previous php.cvs (#140406) next »