Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F726822
D56.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Mon, Jan 6, 1:11 AM
Size
680 B
Mime Type
text/x-diff
Expires
Tue, Jan 7, 1:11 AM (2 d, 13 h ago)
Engine
blob
Format
Raw Data
Handle
536912
Attached To
D56: INP-1417 - Cut trailing zeros properly
D56.diff
View Options
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
Log In to Comment