Bug #53735 [Com]: NumberFormatter returns NaN when converting float point

From: Date: Fri, 01 Oct 2021 12:23:34 +0000
Subject: Bug #53735 [Com]: NumberFormatter returns NaN when converting float point
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-236952@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=53735&edit=1 ID: 53735 Comment by: meave390 at gmail dot com Reported by: mortenskyt at gmail dot com Summary: NumberFormatter returns NaN when converting float point Status: Not a bug Type: Bug Package: I18N and L10N related Operating System: MacOS X 10.6.6 PHP Version: 5.3.5 Block user comment: N Private report: N New Comment: thaks here Previous Comments: ------------------------------------------------------------------------ [2016-06-06 19:16:04] ab@php.net Sorry, but your problem does not imply a bug in PHP itself. For a list of more appropriate places to ask for help using PHP, please visit http://www.php.net/support.php as this bug system is not the appropriate forum for asking support questions. Due to the volume of reports we can not explain in detail here why your report is not a bug. The support channels will be able to provide an explanation for you. Thank you for your interest in PHP. First reported with PHP 5.3, the last comment is about 5.5. ICU version producing the issue stays however within the same version range. Today PHP 5.5+ with ICU 51.2+ shows no issues. This brings to the conclusion, that the issue doesn't lay on PHP. Rougly same ICU (or maybe just data) version range produces the issue. For what matters, I've added ext/intl/tests/bug53735.phpt with all the snippets from this ticket. Thanks. ------------------------------------------------------------------------ [2015-10-01 20:04:11] info at netonme dot de PHP Version 5.5.29-1 ICU version 4.4.1 $fmt = new \NumberFormatter("de_DE", \NumberFormatter::DECIMAL); $fmt->format(23.25); Returns NaN ------------------------------------------------------------------------ [2013-03-11 10:52:43] bghome at gmail dot com I can reproduce this with PHP 5.3.10 on Ubuntu 12.04 64. It is strange for me, because running from CLI works as expected. Code to run: $f = new NumberFormatter('hu_HU', NumberFormatter::PERCENT, '#,##0%'); echo $f->format(0.26) . "\n"; ------------------------------------------------------------------------ [2012-05-24 09:59:00] arthur_jambon at prizee dot fr Get always NaN with NumberFormatter::ORDINAL if the current local is not en_US. PHP 5.3.3 ICU lib 4.4.1-8 OS Debian Squeeze ------------------------------------------------------------------------ [2011-10-07 10:46:40] martin at tajur dot ee The exact same thing happens on all Debian Squeeze installations, given that php5- intl bundle is installed from the default debian package sources. The error appears right after switching locale to something other than default ("en", presumably) and trying to format a number with a comma using NumberFormatter. I was able to fix the issue on Debian Lenny by manually downgrading ICU library to 3.8 but ICU 3.8 does not work on Squeeze which raises importance of this issue even more. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=53735 -- Edit this bug report at https://bugs.php.net/bug.php?id=53735&edit=1

« previous php.bugs (#236952) next »