mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-07-01 15:50:09 +00:00
Networks and Sites: Ensure fileupload_maxk is an int to avoid potential fatal errors.
This changeset fixes a potential fatal error, for example when "Max upload file size" setting is set to an empty value. It also adds unit tests for `upload_size_limit_filter`. Props mjkhajeh, bhrugesh12, SergeyBiryukov, kebbet, audrasjb, felipeelia. Fixes #55926. git-svn-id: https://develop.svn.wordpress.org/trunk@54482 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -2615,12 +2615,14 @@ function is_upload_space_available() {
|
||||
* @return int Upload size limit in bytes.
|
||||
*/
|
||||
function upload_size_limit_filter( $size ) {
|
||||
$fileupload_maxk = KB_IN_BYTES * get_site_option( 'fileupload_maxk', 1500 );
|
||||
$fileupload_maxk = (int) get_site_option( 'fileupload_maxk', 1500 );
|
||||
$max_fileupload_in_bytes = KB_IN_BYTES * $fileupload_maxk;
|
||||
|
||||
if ( get_site_option( 'upload_space_check_disabled' ) ) {
|
||||
return min( $size, $fileupload_maxk );
|
||||
return min( $size, $max_fileupload_in_bytes );
|
||||
}
|
||||
|
||||
return min( $size, $fileupload_maxk, get_upload_space_available() );
|
||||
return min( $size, $max_fileupload_in_bytes, get_upload_space_available() );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user