From 534684d1042978f3c21caf9b665a7aca27f3f325 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Fri, 5 Oct 2018 22:50:34 +0200 Subject: Fixed Bug #76942 U_ARGUMENT_TYPE_MISMATCH ref bug #74484 --- ext/intl/msgformat/msgformat_helpers.cpp | 3 +++ ext/intl/tests/bug74484_MessageFormatter.phpt | 2 ++ 2 files changed, 5 insertions(+) diff --git a/ext/intl/msgformat/msgformat_helpers.cpp b/ext/intl/msgformat/msgformat_helpers.cpp index 29956c7ee0..25fa3e5e1f 100644 --- a/ext/intl/msgformat/msgformat_helpers.cpp +++ b/ext/intl/msgformat/msgformat_helpers.cpp @@ -46,6 +46,7 @@ extern "C" { #if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM >= 48 #define HAS_MESSAGE_PATTERN 1 +#define HAS_MISALLOCATE_MEMORY_BUG 1 #endif U_NAMESPACE_BEGIN @@ -334,6 +335,7 @@ static void umsg_set_timezone(MessageFormatter_object *mfo, return; /* already done */ } +#ifdef HAS_MISALLOCATE_MEMORY_BUG /* There is a bug in ICU which prevents MessageFormatter::getFormats() to handle more than 10 formats correctly. The enumerator could be used to walk through the present formatters using getFormat(), which @@ -351,6 +353,7 @@ static void umsg_set_timezone(MessageFormatter_object *mfo, if (count > 10) { return; } +#endif formats = mf->getFormats(count); diff --git a/ext/intl/tests/bug74484_MessageFormatter.phpt b/ext/intl/tests/bug74484_MessageFormatter.phpt index b48de33525..d3b29a58a4 100644 --- a/ext/intl/tests/bug74484_MessageFormatter.phpt +++ b/ext/intl/tests/bug74484_MessageFormatter.phpt @@ -4,6 +4,8 @@ Bug #74484 MessageFormatter::formatMessage memory corruption with 11+ named plac --FILE-- Date: Fri, 5 Oct 2018 22:51:58 +0200 Subject: Add test for bug #76942 --- ext/intl/tests/bug76942_MessageFormatter.phpt | 33 +++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 ext/intl/tests/bug76942_MessageFormatter.phpt diff --git a/ext/intl/tests/bug76942_MessageFormatter.phpt b/ext/intl/tests/bug76942_MessageFormatter.phpt new file mode 100644 index 0000000000..baafb00ced --- /dev/null +++ b/ext/intl/tests/bug76942_MessageFormatter.phpt @@ -0,0 +1,33 @@ +--TEST-- +Bug #76942 U_ARGUMENT_TYPE_MISMATCH +--SKIPIF-- + +--FILE-- +format($vars); +if ($result === false) { + throw new Exception($formatter->getErrorMessage(), $formatter->getErrorCode()); +} + +var_dump($result); + +?> +==DONE== +--EXPECT-- +string(7) "7,12 MB" +==DONE== -- cgit v1.2.1