From 53593c8ec3fd7c3e55b93c57fbdaffa8da6ad03f Mon Sep 17 00:00:00 2001 From: Marco Germani Date: Tue, 27 Oct 2015 15:48:13 +0100 Subject: [PATCH 1/2] Update Formatter.php string type are cast to integer and have rapresentation of 2147483647 using float type instead for represent larger numbers --- framework/i18n/Formatter.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/framework/i18n/Formatter.php b/framework/i18n/Formatter.php index b9423a2dee..7e5cb1d070 100644 --- a/framework/i18n/Formatter.php +++ b/framework/i18n/Formatter.php @@ -1092,7 +1092,7 @@ class Formatter extends Component * If [[sizeFormatBase]] is 1024, [binary prefixes](http://en.wikipedia.org/wiki/Binary_prefix) (e.g. kibibyte/KiB, mebibyte/MiB, ...) * are used in the formatting result. * - * @param integer $value value in bytes to be formatted. + * @param string|integer|float $value value in bytes to be formatted. * @param integer $decimals the number of digits after the decimal point. * @param array $options optional configuration for the number formatter. This parameter will be merged with [[numberFormatterOptions]]. * @param array $textOptions optional configuration for the number formatter. This parameter will be merged with [[numberFormatterTextOptions]]. @@ -1136,7 +1136,7 @@ class Formatter extends Component * If [[sizeFormatBase]] is 1024, [binary prefixes](http://en.wikipedia.org/wiki/Binary_prefix) (e.g. kibibyte/KiB, mebibyte/MiB, ...) * are used in the formatting result. * - * @param integer $value value in bytes to be formatted. + * @param string|integer|float $value value in bytes to be formatted. * @param integer $decimals the number of digits after the decimal point. * @param array $options optional configuration for the number formatter. This parameter will be merged with [[numberFormatterOptions]]. * @param array $textOptions optional configuration for the number formatter. This parameter will be merged with [[numberFormatterTextOptions]]. From 5747557794e246b634300d47bbb80f1dc4ca6474 Mon Sep 17 00:00:00 2001 From: Marco Germani Date: Fri, 20 Nov 2015 22:45:38 +0100 Subject: [PATCH 2/2] Update Formatter.php In according with the open discussion --- framework/i18n/Formatter.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/i18n/Formatter.php b/framework/i18n/Formatter.php index 7e5cb1d070..37c82377c4 100644 --- a/framework/i18n/Formatter.php +++ b/framework/i18n/Formatter.php @@ -1188,7 +1188,7 @@ class Formatter extends Component private function formatSizeNumber($value, $decimals, $options, $textOptions) { if (is_string($value) && is_numeric($value)) { - $value = (int) $value; + $value = (float) $value; } if (!is_numeric($value)) { throw new InvalidParamException("'$value' is not a numeric value.");