WordPress.org

Make WordPress Core

Ticket #13575: 13575.3.patch

File 13575.3.patch, 839 bytes (added by hakre, 3 years ago)

Updated patch reflecting original php.ini memory_limit value and only if memory_limit is active. W/o a filter.

  • wp-admin/includes/template.php

    ### Eclipse Workspace Patch 1.0
    #P wordpress
     
    821821        $u_bytes = wp_convert_hr_to_bytes( ini_get( 'upload_max_filesize' ) ); 
    822822        $p_bytes = wp_convert_hr_to_bytes( ini_get( 'post_max_size' ) ); 
    823823        $bytes = apply_filters( 'upload_size_limit', min($u_bytes, $p_bytes), $u_bytes, $p_bytes ); 
     824 
     825        if ( function_exists( 'memory_get_usage' ) ) { 
     826                $current = ini_get( 'memory_limit' ); 
     827                ini_restore( 'memory_limit' ); 
     828                $memory_limit = ini_set( 'memory_limit',  $current ); 
     829                $m_bytes = wp_convert_hr_to_bytes( $memory_limit ); 
     830                $bytes = ( $m_bytes < 0 ) ? $bytes : min( $bytes, $m_bytes ); 
     831        } 
     832 
    824833        return $bytes; 
    825834} 
    826835