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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 0 deletions

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]);