php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #62760 regression in _php_math_number_format(d,dec,dec_point,thousand_sep) behaviour
Submitted: 2012-08-06 16:21 UTC Modified: 2015-01-30 06:31 UTC
Votes:2
Avg. Score:4.0 ± 1.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: okneigres at gmail dot com Assigned:
Status: Wont fix Package: Math related
PHP Version: 5.4Git-2012-08-06 (Git) OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: okneigres at gmail dot com
New email:
PHP Version: OS:

 

 [2012-08-06 16:21 UTC] okneigres at gmail dot com
Description:
------------
in php 5.3
char *formatted = _php_math_number_format(1234.56, 2, ".", "\x00");
printf("%s", formatted);
will write "1234.56"
But, in php 5.4 it will write "1"

It happens because _php_math_number_format() in php 5.4 use 
_php_math_number_format_ex(), but code wasn't refactored correctly.

Test script:
---------------
char *formatted = _php_math_number_format(1234.56, 2, ".", "\x00");
printf("returns %s, but correct result is 1234.56", formatted);


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-01-30 06:31 UTC] laruence@php.net
-Status: Open +Status: Wont fix
 [2015-01-30 06:31 UTC] laruence@php.net
use _php_math_number_format_ex instead
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 19:01:28 2024 UTC