Bug #62112 [Opn->Csd]: Regression in number_format() in PHP 5.4
| From: | cataphract@php.net | Date: | Wed, 23 May 2012 09:38:59 +0000 |
| Subject: | Bug #62112 [Opn->Csd]: Regression in number_format() in PHP 5.4 | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-170708@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=62112&edit=1
ID: 62112
Updated by: cataphract@php.net
Reported by: lstrojny@php.net
Summary: Regression in number_format() in PHP 5.4
-Status: Open
+Status: Closed
Type: Bug
Package: Math related
Operating System: Linux
PHP Version: 5.4.3
-Assigned To:
+Assigned To: cataphract
Block user comment: N
Private report: N
New Comment:
This bug has been fixed in SVN.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
For Windows:
http://windows.php.net/snapshots/
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2012-05-22 21:35:45] lstrojny@php.net
Sorry, link is broken: https://github.com/php/php-src/pull/87
------------------------------------------------------------------------
[2012-05-22 21:28:07] lstrojny@php.net
See this pull request for the proposed fix: https://github.com/php/php-
src/pull/87
------------------------------------------------------------------------
[2012-05-22 20:17:40] lstrojny@php.net
Description:
------------
In PHP 5.3.X, passing a null byte as decimal point lead to no decimal point at
all. This is not so much problematic for userland, as for C extensions. For
examlpe phpredis uses it internally (see
https://github.com/nicolasff/phpredis/blob/master/redis.c#L3665)
to format a
number. This worked fine in PHP 5.3, but with PHP 5.4 only the first character
until the first decimal point is returned.
Test script:
---------------
php -r 'var_dump(number_format(2000.1, 0, ".", "\x00"));'
Expected result:
----------------
string(4) "2000"
Actual result:
--------------
string(1) "2"
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=62112&edit=1