Skip to content

Commit 38ffb63

Browse files
committed
Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4: Close the keyword UEnumeration on Locale::getKeywords failure
2 parents 0c3799a + b2956e0 commit 38ffb63

3 files changed

Lines changed: 21 additions & 0 deletions

File tree

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ PHP NEWS
3030
. Fixed Locale::parseLocale() reading past a trailing '-' or '_'.
3131
(iliaal, Xuyang Zhang)
3232
. Fixed grapheme_str_split() treating UBRK_DONE as a byte index. (iliaal)
33+
. Fixed a leak in Locale::getKeywords() when a keyword value cannot be
34+
read. (iliaal)
3335

3436
- Opcache:
3537
. Fixed opcache.protect_memory race under ZTS. (realFlowControl)

ext/intl/locale/locale_methods.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -774,6 +774,7 @@ U_CFUNC PHP_FUNCTION( locale_get_keywords )
774774
zend_string_efree( kw_value_str );
775775
}
776776
zend_array_destroy(Z_ARR_P(return_value));
777+
uenum_close( e );
777778
RETURN_FALSE;
778779
}
779780

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
--TEST--
2+
Locale::getKeywords() closes the keyword enumeration on failure
3+
--EXTENSIONS--
4+
intl
5+
--SKIPIF--
6+
<?php
7+
if (version_compare(INTL_ICU_VERSION, '59.1', '<')) {
8+
die('skip for ICU >= 59.1');
9+
}
10+
?>
11+
--FILE--
12+
<?php
13+
var_dump(Locale::getKeywords('en@foo=bar!'));
14+
var_dump(intl_get_error_code() === U_ILLEGAL_ARGUMENT_ERROR);
15+
?>
16+
--EXPECT--
17+
bool(false)
18+
bool(true)

0 commit comments

Comments
 (0)