From f6ef6c978f19f143b4c29dfffc912357f1e47fa0 Mon Sep 17 00:00:00 2001 From: Carsten Brandt <mail@cebe.cc> Date: Sun, 28 Sep 2014 00:34:29 +0200 Subject: [PATCH] fixed crash of Formatter when intl is not installed related to #5214 --- framework/i18n/Formatter.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/framework/i18n/Formatter.php b/framework/i18n/Formatter.php index b19dabb..a09e146 100644 --- a/framework/i18n/Formatter.php +++ b/framework/i18n/Formatter.php @@ -8,7 +8,6 @@ namespace yii\i18n; use DateTime; -use DateTimeInterface; use IntlDateFormatter; use NumberFormatter; use Yii; @@ -1010,7 +1009,9 @@ class Formatter extends Component // disable grouping for edge cases like 1023 to get 1023 B instead of 1,023 B $oldThousandSeparator = $this->thousandSeparator; $this->thousandSeparator = ''; - $options[NumberFormatter::GROUPING_USED] = false; + if ($this->_intlLoaded) { + $options[NumberFormatter::GROUPING_USED] = false; + } // format the size value $params = [ // this is the unformatted number used for the plural rule -- libgit2 0.27.1