From 9b893cd5587827c5bf2dc300e57bee8591eb7b4c Mon Sep 17 00:00:00 2001 From: Dominik Schilling Date: Tue, 5 Jul 2016 10:36:30 +0000 Subject: [PATCH] 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 --- wp-includes/functions.php | 4 ++++ wp-includes/version.php | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/wp-includes/functions.php b/wp-includes/functions.php index d8cfa324f9..6075f09b51 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -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; diff --git a/wp-includes/version.php b/wp-includes/version.php index a01f051608..fa51ba9df3 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -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.