summaryrefslogtreecommitdiffstats
path: root/admin/WebConsole/includes/comunes.php
diff options
context:
space:
mode:
authorramon <ramongomez@us.es>2018-01-10 10:51:46 +0000
committerramon <ramongomez@us.es>2018-01-10 10:51:46 +0000
commit8e952dae9a144899afcadb874f7d3b72eafc3cdc (patch)
treeecd2fa9edaa43bae8efe6f6ab56eb64242fb7f3f /admin/WebConsole/includes/comunes.php
parent529c585c1459448012ec183f1717e0acb19a2f02 (diff)
#730: Evitar división por 0 al mostrar tamaños de ficheros.
git-svn-id: https://opengnsys.es/svn/branches/version1.1@5549 a21b9725-9963-47de-94b9-378ad31fedc9
Diffstat (limited to 'admin/WebConsole/includes/comunes.php')
-rw-r--r--admin/WebConsole/includes/comunes.php6
1 files changed, 5 insertions, 1 deletions
diff --git a/admin/WebConsole/includes/comunes.php b/admin/WebConsole/includes/comunes.php
index b0dade06..f9f56382 100644
--- a/admin/WebConsole/includes/comunes.php
+++ b/admin/WebConsole/includes/comunes.php
@@ -393,6 +393,10 @@
$si_prefix = array( 'B', 'KB', 'MB', 'GB', 'TB', 'EB', 'ZB', 'YB' );
$base = 1024;
$class = min((int)log($bytes , $base) , count($si_prefix) - 1);
- return sprintf('%1.2f' , $bytes / pow($base,$class)) . ' ' . $si_prefix[$class];
+ if ($class < 0) {
+ return '0 B';
+ } else {
+ return sprintf('%1.2f' , $bytes / pow($base, $class)) . ' ' . $si_prefix[$class];
+ }
}