From 8e952dae9a144899afcadb874f7d3b72eafc3cdc Mon Sep 17 00:00:00 2001 From: ramon Date: Wed, 10 Jan 2018 10:51:46 +0000 Subject: #730: Evitar división por 0 al mostrar tamaños de ficheros. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://opengnsys.es/svn/branches/version1.1@5549 a21b9725-9963-47de-94b9-378ad31fedc9 --- admin/WebConsole/includes/comunes.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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]; + } } -- cgit v1.2.3-18-g5258