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

Ilia Alshanetsky <[email protected]>
Newsgroups gmane.comp.php.cvs.general
Message-ID <[email protected]>
Author: Ilia Alshanetsky (iliaal)
Date: 2026-08-25T18:18:39-04:00

Commit: https://github.com/php/php-src/commit/846773a4e9bfc6df7e672737e3b7b07c4d57b61f
Raw diff: https://github.com/php/php-src/commit/846773a4e9bfc6df7e672737e3b7b07c4d57b61f.diff

Merge branch 'PHP-8.5'

* PHP-8.5:
  Close the keyword UEnumeration on Locale::getKeywords failure

Changed paths:
  A  ext/intl/tests/locale_get_keywords_failure.phpt
  M  NEWS
  M  ext/intl/locale/locale_methods.cpp


Diff:

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--
+<?php
+if (version_compare(INTL_ICU_VERSION, '59.1', '<')) {
+    die('skip for ICU >= 59.1');
+}
+?>
+--FILE--
+<?php
+var_dump(Locale::getKeywords('en@foo=bar!'));
+var_dump(intl_get_error_code() === U_ILLEGAL_ARGUMENT_ERROR);
+?>
+--EXPECT--
+bool(false)
+bool(true)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.