Refactored rounded logic in Utils::parseSize() #2394

This commit is contained in:
Andy Miller
2019-04-15 11:00:11 -06:00
parent 436be17881
commit d69ef0e39c
2 changed files with 4 additions and 3 deletions

View File

@@ -6,6 +6,7 @@
* Better logic in `Utils::normalizePath` to handle externals properly [#2216](https://github.com/getgrav/grav/issues/2216)
* Fixed to force all `Page::taxonomy` to be treated as strings [#2446](https://github.com/getgrav/grav/issues/2446)
* Fixed issue with `Grav['user']` not being available [form#332](https://github.com/getgrav/grav-plugin-form/issues/332)
* Updated rounding logic for `Utils::parseSize()` [#2394](https://github.com/getgrav/grav/issues/2394)
* Fixed Flex simple storage not being properly initialized if used with caching
# v1.6.3

View File

@@ -1405,10 +1405,10 @@ abstract class Utils
$unit = preg_replace('/[^bkmgtpezy]/i', '', $size);
$size = preg_replace('/[^0-9\.]/', '', $size);
if ($unit) {
return (int)((int)$size * (1024 ** stripos('bkmgtpezy', $unit[0])));
return round($size * pow(1024, stripos('bkmgtpezy', $unit[0])));
} else {
return round($size);
}
return (int)$size;
}
/**