wp_max_upload_size does not correctly interpret post_max_size = 0
|Reported by:||maaarghk||Owned by:|
Description (last modified by ocean90)
if 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:
$u_bytes = wp_convert_hr_to_bytes( ini_get( 'upload_max_filesize' ) ); $p_bytes = wp_convert_hr_to_bytes( ini_get( 'post_max_size' ) ); ($p_bytes == 0) ? $p_bytes = $u_bytes : $p_bytes = $p_bytes; $bytes = apply_filters( 'upload_size_limit', min( $u_bytes, $p_bytes ), $u_bytes, $p_bytes ); return $bytes;
This 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.