Skip to content
Snippets Groups Projects
Commit 6a8d3a8e authored by Ere Maijala's avatar Ere Maijala
Browse files

Tweaked ICU workaround in SafeMoneyFormat to only touch LC_NUMERIC as the...

Tweaked ICU workaround in SafeMoneyFormat to only touch LC_NUMERIC as the value of LC_ALL could become too long for setlocale() to handle in the end.
parent a9e54b51
No related merge requests found
...@@ -91,12 +91,12 @@ class SafeMoneyFormat extends AbstractHelper ...@@ -91,12 +91,12 @@ class SafeMoneyFormat extends AbstractHelper
// Workaround for a problem in ICU library < 4.9 causing formatCurrency to // Workaround for a problem in ICU library < 4.9 causing formatCurrency to
// fail if locale has comma as a decimal separator. // fail if locale has comma as a decimal separator.
// (see https://bugs.php.net/bug.php?id=54538) // (see https://bugs.php.net/bug.php?id=54538)
$locale = setlocale(LC_ALL, 0); $locale = setlocale(LC_NUMERIC, 0);
setlocale(LC_ALL, ['en_us.UTF-8', 'en_us.UTF8', 'en_us']); setlocale(LC_NUMERIC, ['en_us.UTF-8', 'en_us.UTF8', 'en_us']);
$result = $escaper( $result = $escaper(
$this->formatter->formatCurrency((float)$number, $currency) $this->formatter->formatCurrency((float)$number, $currency)
); );
setlocale(LC_ALL, $locale); setlocale(LC_NUMERIC, $locale);
return $result; 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