Bug #62112 [NEW]: Regression in number_format() in PHP 5.4
| From: | lstrojny@php.net | Date: | Tue, 22 May 2012 20:17:40 +0000 |
| Subject: | Bug #62112 [NEW]: Regression in number_format() in PHP 5.4 | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-170686@lists.php.net to get a copy of this message | ||
From: lstrojny
Operating system: Linux
PHP version: 5.4.3
Package: Math related
Bug Type: Bug
Bug description:Regression in number_format() in PHP 5.4
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 bug report at https://bugs.php.net/bug.php?id=62112&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=62112&r=trysnapshot54
Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=62112&r=trysnapshot53
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=62112&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=62112&r=fixed
Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=62112&r=needdocs
Fixed in release: https://bugs.php.net/fix.php?id=62112&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=62112&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=62112&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=62112&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=62112&r=support
Expected behavior: https://bugs.php.net/fix.php?id=62112&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=62112&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=62112&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=62112&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=62112&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=62112&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=62112&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=62112&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=62112&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=62112&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=62112&r=mysqlcfg