Skip to content
Snippets Groups Projects
Commit 646062ef authored by Ere Maijala's avatar Ere Maijala Committed by Demian Katz
Browse files

Workaround for a problem in ICU library < 4.9

- Used to cause formatCurrency to fail if locale had comma as a decimal separator.
parent 8ff8fffc
No related merge requests found
......@@ -88,8 +88,15 @@ class SafeMoneyFormat extends AbstractHelper
$currency = $this->defaultCurrency;
}
$escaper = $this->getView()->plugin('escapeHtml');
return $escaper(
// Workaround for a problem in ICU library < 4.9 causing formatCurrency to
// fail if locale has comma as a decimal separator.
// (see https://bugs.php.net/bug.php?id=54538)
$locale = setlocale(LC_ALL, 0);
setlocale(LC_ALL, ['en_us.UTF-8', 'en_us.UTF8', 'en_us']);
$result = $escaper(
$this->formatter->formatCurrency((float)$number, $currency)
);
setlocale(LC_ALL, $locale);
return $result;
}
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment