General: Return "O B" when passing 0 to size_format().

Props swissspidy.
Fixes #36635.
Built from https://develop.svn.wordpress.org/trunk@37962


git-svn-id: http://core.svn.wordpress.org/trunk@37903 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Dominik Schilling 2016-07-05 10:36:30 +00:00
parent a5580012a3
commit 9b893cd558
2 changed files with 5 additions and 1 deletions

View File

@ -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;

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.6-beta1-37961';
$wp_version = '4.6-beta1-37962';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.