mirror of
https://github.com/php/php-src.git
synced 2026-04-14 03:22:58 +02:00
Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1: Add test for bug #76942 Fixed Bug #76942 U_ARGUMENT_TYPE_MISMATCH
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
@@ -4,6 +4,8 @@ Bug #74484 MessageFormatter::formatMessage memory corruption with 11+ named plac
|
||||
<?php
|
||||
if (!extension_loaded('intl'))
|
||||
die('skip intl extension not enabled');
|
||||
if (version_compare(INTL_ICU_VERSION, '4.8') < 0)
|
||||
die('skip for ICU 4.8+');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
33
ext/intl/tests/bug76942_MessageFormatter.phpt
Normal file
33
ext/intl/tests/bug76942_MessageFormatter.phpt
Normal file
@@ -0,0 +1,33 @@
|
||||
--TEST--
|
||||
Bug #76942 U_ARGUMENT_TYPE_MISMATCH
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('intl'))
|
||||
die('skip intl extension not enabled');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$locale = 'nl';
|
||||
$message = '{0,number,#,###.##} MB';
|
||||
$vars = [
|
||||
7.1234
|
||||
];
|
||||
|
||||
$formatter = new MessageFormatter($locale, $message);
|
||||
if (!$formatter) {
|
||||
throw new Exception(intl_get_error_message(), intl_get_error_code());
|
||||
}
|
||||
|
||||
$result = $formatter->format($vars);
|
||||
if ($result === false) {
|
||||
throw new Exception($formatter->getErrorMessage(), $formatter->getErrorCode());
|
||||
}
|
||||
|
||||
var_dump($result);
|
||||
|
||||
?>
|
||||
==DONE==
|
||||
--EXPECT--
|
||||
string(7) "7,12 MB"
|
||||
==DONE==
|
||||
Reference in New Issue
Block a user