WordPress.org

Make WordPress Core

Ticket #23626: 23626.2.patch

File 23626.2.patch, 781 bytes (added by SergeyBiryukov, 5 years ago)
  • wp-includes/deprecated.php

     
    33783378function wp_convert_bytes_to_hr( $bytes ) {
    33793379        _deprecated_function( __FUNCTION__, '3.6', 'size_format()' );
    33803380
    3381         $units = array( 0 => 'B', 1 => 'kB', 2 => 'MB', 3 => 'GB' );
     3381        $units = array( 0 => 'B', 1 => 'kB', 2 => 'MB', 3 => 'GB', 4 => 'TB' );
    33823382        $log   = log( $bytes, 1024 );
    33833383        $power = (int) $log;
     3384        $size  = pow( 1024, $log - $power );
    33843385
    3385         if ( array_key_exists( $power, $units ) ) {
    3386                 $size  = pow( 1024, $log - $power );
     3386        if ( ! is_nan( $size ) && array_key_exists( $power, $units ) ) {
    33873387                $unit = $units[ $power ];
    33883388        } else {
    33893389                $size = $bytes;