Edit report at https://bugs.php.net/bug.php?id=62112&edit=1

 ID:                 62112
 Comment by:         lstro...@php.net
 Reported by:        lstro...@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] lstro...@php.net

See this pull request for the proposed fix: https://github.com/php/php-
src/pull/87

------------------------------------------------------------------------
[2012-05-22 20:17:40] lstro...@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

Reply via email to