Skip to content

Commit

Permalink
PHP 8.1 fix in DataFormatter.php for "Implicit conversion from float …
Browse files Browse the repository at this point in the history
…-INF to int loses precision" (#498)

This fixes a PHP 8.1 bug "Deprecated: Implicit conversion from float -INF to int loses precision in vendor/maximebf/debugbar/src/DebugBar/DataFormatter/DataFormatter.php
  • Loading branch information
beat authored Feb 11, 2022
1 parent 59c1797 commit 70e8062
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/DebugBar/DataFormatter/DataFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,6 @@ public function formatBytes($size, $precision = 2)

$base = log($size) / log(1024);
$suffixes = array('B', 'KB', 'MB', 'GB', 'TB');
return $sign . round(pow(1024, $base - floor($base)), $precision) . $suffixes[floor($base)];
return $sign . round(pow(1024, $base - floor($base)), $precision) . $suffixes[(int) floor($base)];
}
}

0 comments on commit 70e8062

Please sign in to comment.