Do not try to format size if 0

This commit is contained in:
Frederic Guillot
2017-02-04 18:25:41 -05:00
parent fe3ac50aca
commit 6307070507
2 changed files with 5 additions and 0 deletions

View File

@@ -59,6 +59,10 @@ class TextHelper extends Base
*/
public function bytes($size, $precision = 2)
{
if ($size == 0) {
return 0;
}
$base = log($size) / log(1024);
$suffixes = array('', 'k', 'M', 'G', 'T');