Skip to content

Commit ea2a125

Browse files
committed
Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2: Fix bug #78804 - Segmentation fault in Locale::filterMatches
2 parents 4a55794 + 2c9926f commit ea2a125

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

ext/intl/locale/locale_methods.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1285,15 +1285,15 @@ PHP_FUNCTION(locale_filter_matches)
12851285
if( boolCanonical ){
12861286
/* canonicalize loc_range */
12871287
can_loc_range=get_icu_value_internal( loc_range , LOC_CANONICALIZE_TAG , &result , 0);
1288-
if( result ==0) {
1288+
if( result <=0) {
12891289
intl_error_set( NULL, status,
12901290
"locale_filter_matches : unable to canonicalize loc_range" , 0 );
12911291
RETURN_FALSE;
12921292
}
12931293

12941294
/* canonicalize lang_tag */
12951295
can_lang_tag = get_icu_value_internal( lang_tag , LOC_CANONICALIZE_TAG , &result , 0);
1296-
if( result ==0) {
1296+
if( result <=0) {
12971297
intl_error_set( NULL, status,
12981298
"locale_filter_matches : unable to canonicalize lang_tag" , 0 );
12991299
RETURN_FALSE;

ext/intl/tests/bug78804.phpt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
--TEST--
2+
Bug #78804: Segmentation fault in Locale::filterMatches
3+
--FILE--
4+
<?php
5+
6+
if (Locale::filterMatches('en-US', 'und', true)) {
7+
echo 'Matches';
8+
} else {
9+
echo 'Not matches';
10+
}
11+
?>
12+
--EXPECT--
13+
Not matches

0 commit comments

Comments
 (0)