Development

#4521 (Bug in sfNumberFormat when handling large numbers)

You must first sign up to be able to contribute.

Ticket #4521 (closed defect: fixed)

Opened 1 year ago

Last modified 9 months ago

Bug in sfNumberFormat when handling large numbers

Reported by: paul Assigned to: fabien
Priority: minor Milestone: 1.1.5
Component: i18n Version: 1.1.2
Keywords: Cc:
Qualification: Unreviewed

Description

Line 174 of sfNumberFormat.class.php reads:

$string = (string) round(floatval($string), $decimalDigits);

There's a chance a float can be returned here, and when converted to a string it will simply show the first digit. I've added intval() to the line here:

$string = (string) intval(round(floatval($string), $decimalDigits));

Example: I was passing 14000000, the result of round() and floatval() was 1.4E+7 which converted to a string read 1.

Change History

09/29/08 15:32:18 changed by paul

  • version changed from 1.0.18 to 1.1.2.

10/05/08 18:52:33 changed by fabien

  • milestone set to 1.1.5.

10/05/08 18:53:02 changed by FabianLange

  • status changed from new to closed.
  • resolution set to fixed.

fixed in r11958

07/08/09 12:50:10 changed by theq

This problem (float printing once with E notation one not) is actually bigger. It started in PHP >5.2.1 and its major pain in the a$$ when you want to put floats in decimal database fields and you dont know if you get E notation or not. More read http://bugs.php.net/bug.php?id=43053

07/08/09 13:45:46 changed by theq

PS. not teribad cos afaik E notation is working in SQL

The Sensio Labs Network

Since 1998, Sensio Labs has been promoting the Open-Source software movement by providing quality web application development, training, consulting.
Sensio Labs also supports several large Open-Source projects.