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

 ID:                 60977
 Comment by:         php-dev at zerocue dot com
 Reported by:        chobie...@php.net
 Summary:            number_format behavior changed when passing \0 for
                     4th parameter.
 Status:             Open
 Type:               Bug
 Package:            Math related
 Operating System:   OSX
 PHP Version:        5.4.0RC7
 Block user comment: N
 Private report:     N

 New Comment:

This is interesting, I would think that the 5_4 functionality is more correct, 
because you're adding a null character as the thousands separator so the string 
is 
becoming: 
1\0328\0370\0011.72399998

Internally a null character terminates a C style string.  I would think the 
appropriate fix would be to limit the fourth parameter to displayable 
characters.

This probably changed as a result of a bugfix somewhere.


Previous Comments:
------------------------------------------------------------------------
[2012-02-04 15:58:09] chobie...@php.net

Description:
------------
when I run the test code on php5.3. php returns `1328370011.72399998`.
but in php5.4 that returns `1`.

i don't know which behavior is correct. i think it should be returns same 
result.

Test script:
---------------
<?php
echo number_format(1328370011.724,"8",".", "\0");

Expected result:
----------------
1328370011.72399998

Actual result:
--------------
1


------------------------------------------------------------------------



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

Reply via email to