diff options
author | Frederic Guillot <fred@kanboard.net> | 2017-08-11 22:29:43 -0700 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2017-08-11 22:29:43 -0700 |
commit | 3ba8b0462c682a66eda0120c0ebbc37ee740e39c (patch) | |
tree | bf3474150d5169c232bd63097f8646a3ae17d361 /app/Helper | |
parent | b79b18efd7a1a8b591753a4eddd473f88d55b7df (diff) |
Fix parsing issue in phpToBytes()
Diffstat (limited to 'app/Helper')
-rw-r--r-- | app/Helper/TextHelper.php | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/app/Helper/TextHelper.php b/app/Helper/TextHelper.php index 89c1a8f3..698bef6d 100644 --- a/app/Helper/TextHelper.php +++ b/app/Helper/TextHelper.php @@ -90,19 +90,19 @@ class TextHelper extends Base */ public function phpToBytes($val) { - $val = trim($val); - $last = strtolower($val[strlen($val)-1]); + $size = (int) substr($val, 0, -1); + $last = strtolower(substr($val, -1)); switch ($last) { case 'g': - $val *= 1024; + $size *= 1024; case 'm': - $val *= 1024; + $size *= 1024; case 'k': - $val *= 1024; + $size *= 1024; } - return $val; + return $size; } /** |