|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2018-09-27 17:00 UTC] bassemnassief at gmail dot com
Description: ------------ Hello, After upgrading to PHP 7.1.22, I got the following error >> Uncaught Exception: U_ARGUMENT_TYPE_MISMATCH and after doing some tests I found that ICU version 4.2.1 seems to be not compatible with PHP 7.1 although it is mentioned that it should work with ICU library version 4.0.0 or newer as mentioned here http://php.net/manual/en/intl.requirements.php Thanks Test script: --------------- <?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()); } echo $result; Expected result: ---------------- 7,12 MB Actual result: -------------- PHP Fatal error: Uncaught Exception: U_ARGUMENT_TYPE_MISMATCH in file.php:16 Stack trace: #0 {main} thrown in file.php on line 16 Patchesphp-7.1.22-msgformatter.patch (last revision 2018-10-01 13:33 UTC by anthrax at unixuser dot org)Pull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 00:00:02 2025 UTC |
The API used by patch # 74474 is from 4.0 or earlier, but U_ARGUMENT_TYPE_MISMATCH is returned. I guess there is no API compatibility. tried? It is different that API exists and works well, is not it? Also, Implementation of getFormats is different from ICU 4.8 + and earlier. before ICU-4.8: ``` if (formatAliases == NULL) { t->formatAliasesCapacity = (subformatCount<10) ? 10 : subformatCount; Format** a = (Format**) uprv_malloc(sizeof(Format*) * formatAliasesCapacity); ``` ICU-4.8+: ``` if (formatAliases == NULL) { t->formatAliasesCapacity = (argTypeCount<10) ? 10 : argTypeCount; Format** a = (Format**) uprv_malloc(sizeof(Format*) * formatAliasesCapacity); ``` I think that checking subformatCount is correct, is not it?