diff --git a/NEWS b/NEWS index 5276069926e5..571d8d82e012 100644 --- a/NEWS +++ b/NEWS @@ -6,6 +6,10 @@ PHP NEWS . Fixed bug GH-23242 (PHP development server does not support Expect 100-continue flow control). (Sjoerd Langkemper) +- Intl: + . Fixed a leak in Locale::getKeywords() when a keyword value cannot be + read. (iliaal) + 27 Aug 2026, PHP 8.6.0beta2 diff --git a/ext/intl/locale/locale_methods.cpp b/ext/intl/locale/locale_methods.cpp index 8cc7e5a800b5..911abfdc5c11 100644 --- a/ext/intl/locale/locale_methods.cpp +++ b/ext/intl/locale/locale_methods.cpp @@ -891,6 +891,7 @@ PHP_INTL_FUNCTION_WITH_ERROR_RESET(locale_get_keywords) zend_string_efree( kw_value_str ); } zend_array_destroy(Z_ARR_P(return_value)); + uenum_close( e ); RETURN_FALSE; } diff --git a/ext/intl/tests/locale_get_keywords_failure.phpt b/ext/intl/tests/locale_get_keywords_failure.phpt new file mode 100644 index 000000000000..823da63ca541 --- /dev/null +++ b/ext/intl/tests/locale_get_keywords_failure.phpt @@ -0,0 +1,18 @@ +--TEST-- +Locale::getKeywords() closes the keyword enumeration on failure +--EXTENSIONS-- +intl +--SKIPIF-- += 59.1'); +} +?> +--FILE-- + +--EXPECT-- +bool(false) +bool(true)