Page MenuHomeIn-Portal Phabricator

D56.diff
No OneTemporary

File Metadata

Created
Mon, Jan 6, 1:11 AM

D56.diff

Index: branches/5.2.x/core/kernel/utility/formatters/formatter.php
===================================================================
--- branches/5.2.x/core/kernel/utility/formatters/formatter.php
+++ branches/5.2.x/core/kernel/utility/formatters/formatter.php
@@ -180,8 +180,8 @@
$value = sprintf($format, $value);
if ( isset($options['cut_zeros']) && $options['cut_zeros'] ) {
- // converts 5.00 to 5, but doesn't change 5.340 or 5.34
- $value = preg_replace('/\.[0]+$/', '', $value);
+ // Remove trailing zeros in decimal part (including "." if any left at the end).
+ $value = rtrim(preg_replace('/\.([1-9]*)[0]+$/', '.$1', $value), '.');
}
}

Event Timeline