WordPress.org

Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #24558


Ignore:
Timestamp:
06/11/2013 06:51:58 AM (5 years ago)
Author:
ocean90
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #24558 – Description

    initial v1  
    11if ini_get( 'post_max_size' ) returns 0 then there the post size is unlimited. WP treats this as if the max size is 0 bytes. a quick fix is in wp-includes/media.php : update function wp_max_upload_size() as follows:
    22
    3  {
     3 {{{
    44        $u_bytes = wp_convert_hr_to_bytes( ini_get( 'upload_max_filesize' ) );
    55        $p_bytes = wp_convert_hr_to_bytes( ini_get( 'post_max_size' ) );
     
    77        $bytes   = apply_filters( 'upload_size_limit', min( $u_bytes, $p_bytes ), $u_bytes, $p_bytes );
    88        return $bytes;
    9 }
     9}}}
    1010
    1111This is dirty code but does the job - I feel the proper place for the fix is behind the upload_size_limit filter but I don't know enough about WP to provide a proper patch. However, by setting post_max_size=0 and testing this code you should be able to reproduce the bug easily.