php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
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

Add a Patch

Pull Requests

Add a Pull Request

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
Automatic comment on behalf of stas
Revision: http://git.php.net/?p=php-src.git;a=commit;h=6c8a570a969b262d233350829ead759364a29e82
Log: Fix bug #67052 (NumberFormatter::parse() resets LC_NUMERIC setting)
 [2014-07-07 07:39 UTC] stas@php.net
-Status: Open +Status: Closed
 [2014-07-07 15:22 UTC] dmitry@php.net
Automatic comment on behalf of stas
Revision: http://git.php.net/?p=php-src.git;a=commit;h=6c8a570a969b262d233350829ead759364a29e82
Log: Fix bug #67052 (NumberFormatter::parse() resets LC_NUMERIC setting)
 [2014-07-21 09:31 UTC] ab@php.net
Automatic comment on behalf of stas
Revision: http://git.php.net/?p=php-src.git;a=commit;h=6c8a570a969b262d233350829ead759364a29e82
Log: Fix bug #67052 (NumberFormatter::parse() resets LC_NUMERIC setting)
 [2014-07-21 10:02 UTC] ab@php.net
Automatic comment on behalf of stas
Revision: http://git.php.net/?p=php-src.git;a=commit;h=6c8a570a969b262d233350829ead759364a29e82
Log: Fix bug #67052 (NumberFormatter::parse() resets LC_NUMERIC setting)
 [2014-07-30 09:52 UTC] tyrael@php.net
Automatic comment on behalf of stas
Revision: http://git.php.net/?p=php-src.git;a=commit;h=6c8a570a969b262d233350829ead759364a29e82
Log: Fix bug #67052 (NumberFormatter::parse() resets LC_NUMERIC setting)
 [2014-10-07 23:14 UTC] stas@php.net
Automatic comment on behalf of stas
Revision: http://git.php.net/?p=php-src-security.git;a=commit;h=6c8a570a969b262d233350829ead759364a29e82
Log: Fix bug #67052 (NumberFormatter::parse() resets LC_NUMERIC setting)
 [2014-10-07 23:25 UTC] stas@php.net
Automatic comment on behalf of stas
Revision: http://git.php.net/?p=php-src-security.git;a=commit;h=6c8a570a969b262d233350829ead759364a29e82
Log: Fix bug #67052 (NumberFormatter::parse() resets LC_NUMERIC setting)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 03:01:29 2024 UTC