1
0
mirror of https://github.com/prasathmani/tinyfilemanager.git synced 2025-07-28 12:31:10 +02:00

Notice: A non well formed numeric value encountered (#386)

Eliminates the following PHP warnings when error reporting is turned on:

Notice: A non well formed numeric value encountered in tinyfilemanager.php on line 2443
Notice: A non well formed numeric value encountered in tinyfilemanager.php on line 2444

This happens because PHP floor and round are expecting a (float), not an (int).
This commit is contained in:
Michael Milette
2020-06-27 06:32:09 -04:00
committed by GitHub
parent e118d650a3
commit c741ae2212

View File

@@ -2439,6 +2439,7 @@ function fm_get_size($file)
*/
function fm_get_filesize($size)
{
$size = (float) $size;
$units = array('B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB');
$power = $size > 0 ? floor(log($size, 1024)) : 0;
return sprintf('%s %s', round($size / pow(1024, $power), 2), $units[$power]);