diff options
author | Stanislav Malyshev <stas@php.net> | 2019-11-11 23:08:44 -0800 |
---|---|---|
committer | Stanislav Malyshev <stas@php.net> | 2019-11-11 23:08:44 -0800 |
commit | 686a24c1ebc35b96ea7b64cc51e13b2bb5faf833 (patch) | |
tree | 6d43013ec951df59ad6badf6ec976fec7cf5b196 /ext | |
parent | ce047e60911400c97d585a09a69770898aa4cf78 (diff) | |
parent | ea2a125789d2e6cf7416bd706be1ac44df1367e4 (diff) | |
download | php-git-686a24c1ebc35b96ea7b64cc51e13b2bb5faf833.tar.gz |
Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
Fix bug #78804 - Segmentation fault in Locale::filterMatches
Diffstat (limited to 'ext')
-rw-r--r-- | ext/intl/locale/locale_methods.c | 4 | ||||
-rw-r--r-- | ext/intl/tests/bug78804.phpt | 13 |
2 files changed, 15 insertions, 2 deletions
diff --git a/ext/intl/locale/locale_methods.c b/ext/intl/locale/locale_methods.c index 4c5476f6aa..50838de7ed 100644 --- a/ext/intl/locale/locale_methods.c +++ b/ext/intl/locale/locale_methods.c @@ -1285,7 +1285,7 @@ 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; @@ -1293,7 +1293,7 @@ PHP_FUNCTION(locale_filter_matches) /* 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; diff --git a/ext/intl/tests/bug78804.phpt b/ext/intl/tests/bug78804.phpt new file mode 100644 index 0000000000..b0d58ec430 --- /dev/null +++ b/ext/intl/tests/bug78804.phpt @@ -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
\ No newline at end of file |