mirror of
https://github.com/prasathmani/tinyfilemanager
synced 2024-05-09 00:56:36 +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:
parent
e118d650a3
commit
c741ae2212
|
@ -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]);
|
||||
|
|
Loading…
Reference in a new issue