Bug #53735 [Fbk->Opn]: NumberFormatter returns NaN when converting float point

From: Date: Sat, 22 Jan 2011 12:40:59 +0000
Subject: Bug #53735 [Fbk->Opn]: NumberFormatter returns NaN when converting float point
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-158075@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=53735&edit=1

 ID:                 53735
 User updated by:    mortenskyt at gmail dot com
 Reported by:        mortenskyt at gmail dot com
 Summary:            NumberFormatter returns NaN when converting float
                     point
-Status:             Feedback
+Status:             Open
 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:

Hello again,

On my Mac with PHP 5.3.5 from Macports:

Internationalization support => enabled
version => 1.1.0
ICU version => 4.6

(same version on non-working FreeBSD PHP 5.3.4-machine)


The FreeBSD-machine with PHP 5.3.3, which works with no issues:

Internationalization support => enabled
version => 1.0.3
ICU version => 3.8.1


Previous Comments:
------------------------------------------------------------------------
[2011-01-22 08:41:40] stas@php.net

Works for me in 5.3 on Mac OS X. Which ICU version do you have (check
phpinfo())?

------------------------------------------------------------------------
[2011-01-13 14:46:59] mortenskyt at gmail dot com

Description:
------------
In PHP 5.3.5, giving float point values to numfmt_format doesn't work
when 
setlocale is set to a country using comma instead of dot in floating
point.

Also does not work in PHP 5.3.4 (FreeBSD)

DOES work on 5.3.3 (FreeBSD)


Perhaps interesting notes from my configuration:

intl
Internationalization support => enabled
version => 1.1.0
ICU version => 4.6

Directive => Local Value => Master Value
intl.default_locale => no value => no value
intl.error_level => 0 => 0

Test script:
---------------
<?php
$fmt = numfmt_create("da_DK", \NumberFormatter::CURRENCY);

echo numfmt_format($fmt, 5.5)."\n";
setlocale(LC_ALL, "da_DK.UTF-8");

echo numfmt_format($fmt, 5.5)."\n";
echo numfmt_format($fmt, "5,5")."\n";

Expected result:
----------------
5,50 kr
5,50 kr
5,00 kr

Actual result:
--------------
5,50 kr
NaN
5,00 kr


------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=53735&edit=1


Thread (11 messages)

« previous php.bugs (#158075) next »