Skip to content

Commit 2c9926f

Browse files
committed
Fix bug #78804 - Segmentation fault in Locale::filterMatches
1 parent ee243bc commit 2c9926f

File tree

3 files changed

+20
-4
lines changed

3 files changed

+20
-4
lines changed

NEWS

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ PHP NEWS
22
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
33
?? ??? 2019, PHP 7.2.26
44

5+
- Intl:
6+
. Fixed bug #78804 (Segmentation fault in Locale::filterMatches). (Stas)
7+
58
- Standard:
69
. Fixed bug #78759 (array_search in $GLOBALS). (Nikita)
710

@@ -27,7 +30,7 @@ PHP NEWS
2730
cmb).
2831

2932
- OpCache:
30-
. Fixed bug #78654 (Incorrectly computed opcache checksum on files with
33+
. Fixed bug #78654 (Incorrectly computed opcache checksum on files with
3134
non-ascii characters). (mhagstrand)
3235
. Fixed bug #78747 (OpCache corrupts custom extension result). (Nikita)
3336

@@ -36,7 +39,7 @@ PHP NEWS
3639
connections). (Nikita)
3740

3841
- Reflection:
39-
. Fixed bug #78697 (ReflectionClass::ImplementsInterface - inaccurate error
42+
. Fixed bug #78697 (ReflectionClass::ImplementsInterface - inaccurate error
4043
message with traits). (villfa)
4144

4245
- Sockets:

ext/intl/locale/locale_methods.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1292,15 +1292,15 @@ PHP_FUNCTION(locale_filter_matches)
12921292
if( boolCanonical ){
12931293
/* canonicalize loc_range */
12941294
can_loc_range=get_icu_value_internal( loc_range , LOC_CANONICALIZE_TAG , &result , 0);
1295-
if( result ==0) {
1295+
if( result <=0) {
12961296
intl_error_set( NULL, status,
12971297
"locale_filter_matches : unable to canonicalize loc_range" , 0 );
12981298
RETURN_FALSE;
12991299
}
13001300

13011301
/* canonicalize lang_tag */
13021302
can_lang_tag = get_icu_value_internal( lang_tag , LOC_CANONICALIZE_TAG , &result , 0);
1303-
if( result ==0) {
1303+
if( result <=0) {
13041304
intl_error_set( NULL, status,
13051305
"locale_filter_matches : unable to canonicalize lang_tag" , 0 );
13061306
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)