Bug #64424 [Opn->Csd]: number_format is not multibyte safe
| From: | nikic@php.net | Date: | Thu, 14 Mar 2013 07:02:26 +0000 |
| Subject: | Bug #64424 [Opn->Csd]: number_format is not multibyte safe | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-177773@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=64424&edit=1
ID: 64424
Updated by: nikic@php.net
Reported by: mwalker at wikimedia dot org
Summary: number_format is not multibyte safe
-Status: Open
+Status: Closed
Type: Bug
Package: *Unicode Issues
Operating System: Ubuntu 12.04
PHP Version: 5.3.22
-Assigned To:
+Assigned To: nikic
Block user comment: N
Private report: N
New Comment:
Support for this has already been added in PHP 5.4. See the changelog from http://php.net/number_format:
5.4.0 This function now supports multiple bytes in dec_point and thousands_sep. Only the first byte
of each separator was used in older versions.
Previous Comments:
------------------------------------------------------------------------
[2013-03-14 01:26:36] mwalker at wikimedia dot org
Description:
------------
I have a UTF-8 PHP file that initializes an array of characters depending on the
locale. Some of these are multibyte strings.
When using the number_format() function with $dec_point, or $thousands_sep set
with one of these multibyte entries the returned result contains only the first
byte of the string (which is only a partial code point.)
Test script:
---------------
$foo = "\xC2\xA0";
$result = number_format(1.23, $foo, $foo);
Expected result:
----------------
$result to contain "\x31\xC2\xA0\x32\x33"
Actual result:
--------------
$result seems to contain "\x31\xC2\x32\x33"
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=64424&edit=1