From e3148fb526908e209b2f03e4b71684ce640ec212 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Fri, 1 Mar 2013 15:59:10 +0000 Subject: [PATCH] Make wp_convert_bytes_to_hr() return consistent results on 32-bit and 64-bit systems. fixes #23626. git-svn-id: http://core.svn.wordpress.org/trunk@23551 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/deprecated.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/wp-includes/deprecated.php b/wp-includes/deprecated.php index f1e8e642e3..8d336869fd 100644 --- a/wp-includes/deprecated.php +++ b/wp-includes/deprecated.php @@ -3378,12 +3378,12 @@ function gd_edit_image_support($mime_type) { function wp_convert_bytes_to_hr( $bytes ) { _deprecated_function( __FUNCTION__, '3.6', 'size_format()' ); - $units = array( 0 => 'B', 1 => 'kB', 2 => 'MB', 3 => 'GB' ); + $units = array( 0 => 'B', 1 => 'kB', 2 => 'MB', 3 => 'GB', 4 => 'TB' ); $log = log( $bytes, 1024 ); $power = (int) $log; + $size = pow( 1024, $log - $power ); - if ( array_key_exists( $power, $units ) ) { - $size = pow( 1024, $log - $power ); + if ( ! is_nan( $size ) && array_key_exists( $power, $units ) ) { $unit = $units[ $power ]; } else { $size = $bytes;