Skip to content

Commit

Permalink
Merge branch 'PHP-7.4'
Browse files Browse the repository at this point in the history
* PHP-7.4:
  Fix bug #78804 - Segmentation fault in Locale::filterMatches
  • Loading branch information
smalyshev committed Nov 12, 2019
2 parents 735c4ca + 686a24c commit ad0a3f2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ext/intl/locale/locale_methods.c
Original file line number Diff line number Diff line change
Expand Up @@ -1259,15 +1259,15 @@ PHP_FUNCTION(locale_filter_matches)
if( boolCanonical ){
/* canonicalize loc_range */
can_loc_range=get_icu_value_internal( loc_range , LOC_CANONICALIZE_TAG , &result , 0);
if( result ==0) {
if( result <=0) {
intl_error_set( NULL, status,
"locale_filter_matches : unable to canonicalize loc_range" , 0 );
RETURN_FALSE;
}

/* canonicalize lang_tag */
can_lang_tag = get_icu_value_internal( lang_tag , LOC_CANONICALIZE_TAG , &result , 0);
if( result ==0) {
if( result <=0) {
intl_error_set( NULL, status,
"locale_filter_matches : unable to canonicalize lang_tag" , 0 );
RETURN_FALSE;
Expand Down
13 changes: 13 additions & 0 deletions ext/intl/tests/bug78804.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
--TEST--
Bug #78804: Segmentation fault in Locale::filterMatches
--FILE--
<?php

if (Locale::filterMatches('en-US', 'und', true)) {
echo 'Matches';
} else {
echo 'Not matches';
}
?>
--EXPECT--
Not matches

0 comments on commit ad0a3f2

Please sign in to comment.