aboutsummaryrefslogtreecommitdiffstats
path: root/include/text.php
diff options
context:
space:
mode:
authorredmatrix <git@macgirvin.com>2016-04-29 23:47:13 -0700
committerredmatrix <git@macgirvin.com>2016-04-29 23:47:13 -0700
commit4c47d22f4b00a2536e681ef62225e3795acf378a (patch)
treef1b6f342fb853d11f03cd7c879e68e7c8ab790e1 /include/text.php
parentbb96f44861c66e9eb334e18e4b4b659685433008 (diff)
downloadvolse-hubzilla-4c47d22f4b00a2536e681ef62225e3795acf378a.tar.gz
volse-hubzilla-4c47d22f4b00a2536e681ef62225e3795acf378a.tar.bz2
volse-hubzilla-4c47d22f4b00a2536e681ef62225e3795acf378a.zip
trim engr_units string slight improvement to avoid subtle bugs
Diffstat (limited to 'include/text.php')
-rw-r--r--include/text.php4
1 files changed, 3 insertions, 1 deletions
diff --git a/include/text.php b/include/text.php
index f1043909d..f8bc4b6b0 100644
--- a/include/text.php
+++ b/include/text.php
@@ -1826,7 +1826,9 @@ function lang_selector() {
function engr_units_to_bytes ($size_str) {
- switch (substr ($size_str, -1)) {
+ if(! $size_str)
+ return $size_str;
+ switch (substr(trim($size_str), -1)) {
case 'M': case 'm': return (int)$size_str * 1048576;
case 'K': case 'k': return (int)$size_str * 1024;
case 'G': case 'g': return (int)$size_str * 1073741824;