PHP :: Bug #67052 :: NumberFormatter::parse() resets LC_NUMERIC setting

Bug #67052 NumberFormatter::parse() resets LC_NUMERIC setting
Submitted: 2014-04-10 07:28 UTC Modified: 2014-07-07 07:34 UTC
From: omer at sabic dot si Assigned:
Status: Closed Package: intl (PECL)
PHP Version: 5.4.27 OS: Ubuntu 12.04
Private report: No CVE-ID: None

 [2014-04-10 07:28 UTC] omer at sabic dot si

Description:
------------
---
From manual page: http://www.php.net/numberformatter.parse
---
When I use the NumberFormatter::parse() method, the LC_NUMERIC locale setting is reset to "C".
The sample code is self-explanatory. The same happens on PHP 5.3, with other locales too (tested with en_GB.UTF-8, de_DE.UTF-8 and it_IT.UTF-8).

Test script:
---------------
setlocale(LC_ALL, 'sl_SI.UTF-8');
echo setlocale(LC_NUMERIC, 0) . "\n";

$fmt = new NumberFormatter( 'sl_SI.UTF-8', NumberFormatter::DECIMAL);
$num = "1.234.567,891";
echo $fmt->parse($num)."\n";

echo setlocale(LC_NUMERIC, 0);

Expected result:
----------------
sl_SI.UTF-8
1234567.891
sl_SI.UTF-8

Actual result:
--------------
sl_SI.UTF-8
1234567.891
C

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports

 [2014-06-01 18:07 UTC] omer at sabic dot si

Confirmed also on 5.3.3 and 5.5.9. Both have intl 1.1.0

 [2014-07-07 07:34 UTC] stas@php.net

Expected result actually should be 1234567,891 since sl_SI.UTF-8 uses commas.

 [2014-07-07 07:39 UTC] stas@php.net

-Status: Open +Status: Closed