Bug #62112 [Com]: Regression in number_format() in PHP 5.4
| From: | lstrojny@php.net | Date: | Tue, 22 May 2012 21:35:45 +0000 |
| Subject: | Bug #62112 [Com]: Regression in number_format() in PHP 5.4 | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-170689@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
Comment by: lstrojny@php.net
Reported by: lstrojny@php.net
Summary: Regression in number_format() in PHP 5.4
Status: Open
Type: Bug
Package: Math related
Operating System: Linux
PHP Version: 5.4.3
Block user comment: N
Private report: N
New Comment:
Sorry, link is broken: https://github.com/php/php-src/pull/87
Previous Comments:
------------------------------------------------------------------------
[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