|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #62112 Regression in number_format() in PHP 5.4
Submitted: 2012-05-22 20:17 UTC Modified: 2012-05-23 09:38 UTC
From: Assigned: cataphract
Status: Closed Package: Math related
PHP Version: 5.4.3 OS: Linux
Private report: No CVE-ID:
 [2012-05-22 20:17 UTC]
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 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"


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2012-05-22 21:28 UTC]
See this pull request for the proposed fix:
 [2012-05-22 21:35 UTC]
Sorry, link is broken:
 [2012-05-23 09:38 UTC]
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

 For Windows:
Thank you for the report, and for helping us make PHP better.

 [2012-05-23 09:38 UTC]
-Status: Open +Status: Closed -Assigned To: +Assigned To: cataphract
 [2012-05-23 09:39 UTC]
Automatic comment on behalf of cataphract
Log: Fix bug #62112: number_format() is not binary safe
 [2012-07-18 06:19 UTC]
Automatic comment on behalf of stas
Log: Revert "Fix bug #62112: number_format() is not binary safe"
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Fri Apr 18 02:02:27 2014 UTC