mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 14:20:15 +00:00
General: Return "O B" when passing 0 to size_format().
Props swissspidy. Fixes #36635. git-svn-id: https://develop.svn.wordpress.org/trunk@37962 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -263,6 +263,10 @@ function size_format( $bytes, $decimals = 0 ) {
|
||||
'B' => 1,
|
||||
);
|
||||
|
||||
if ( 0 === $bytes ) {
|
||||
return number_format_i18n( 0, $decimals ) . ' B';
|
||||
}
|
||||
|
||||
foreach ( $quant as $unit => $mag ) {
|
||||
if ( doubleval( $bytes ) >= $mag ) {
|
||||
return number_format_i18n( $bytes / $mag, $decimals ) . ' ' . $unit;
|
||||
|
||||
Reference in New Issue
Block a user