summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStanislav Malyshev <stas@php.net>2019-11-11 22:30:08 -0800
committerStanislav Malyshev <stas@php.net>2019-11-11 22:32:35 -0800
commit2c9926f156b2be6aa4f69a169d028c1ebc1eaa34 (patch)
treefc884f5576b50b7a5fd481ad3b5ffc3a9c74af73
parentee243bc47155f8738b329bc5ce2fa95753c38154 (diff)
downloadphp-git-2c9926f156b2be6aa4f69a169d028c1ebc1eaa34.tar.gz
Fix bug #78804 - Segmentation fault in Locale::filterMatches
-rw-r--r--NEWS7
-rw-r--r--ext/intl/locale/locale_methods.c4
-rw-r--r--ext/intl/tests/bug78804.phpt13
3 files changed, 20 insertions, 4 deletions
diff --git a/NEWS b/NEWS
index 3160a9fdaa..4deb2e12fb 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,9 @@ PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? 2019, PHP 7.2.26
+- Intl:
+ . Fixed bug #78804 (Segmentation fault in Locale::filterMatches). (Stas)
+
- Standard:
. Fixed bug #78759 (array_search in $GLOBALS). (Nikita)
@@ -27,7 +30,7 @@ PHP NEWS
cmb).
- OpCache:
- . Fixed bug #78654 (Incorrectly computed opcache checksum on files with
+ . Fixed bug #78654 (Incorrectly computed opcache checksum on files with
non-ascii characters). (mhagstrand)
. Fixed bug #78747 (OpCache corrupts custom extension result). (Nikita)
@@ -36,7 +39,7 @@ PHP NEWS
connections). (Nikita)
- Reflection:
- . Fixed bug #78697 (ReflectionClass::ImplementsInterface - inaccurate error
+ . Fixed bug #78697 (ReflectionClass::ImplementsInterface - inaccurate error
message with traits). (villfa)
- Sockets:
diff --git a/ext/intl/locale/locale_methods.c b/ext/intl/locale/locale_methods.c
index 768ae84d2c..3379916822 100644
--- a/ext/intl/locale/locale_methods.c
+++ b/ext/intl/locale/locale_methods.c
@@ -1292,7 +1292,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;
@@ -1300,7 +1300,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