Media: Remove error suppression in wp_filesize().

Replace error suppressing in `wp_filesize()` with a `file_exists()` check before calling the native PHP `filesize()` function.

Follow up to [52837].

Props Cybr, johnbillion, spacedmonkey, antpb, azouamauriac, ironprogrammer, mukesh27, costdev, audrasjb, dlh, peterwilsoncc.
Merges [53372] to the 6.0 branch.
Fixes #55678.
See #49412.
Built from https://develop.svn.wordpress.org/branches/6.0@53380


git-svn-id: http://core.svn.wordpress.org/branches/6.0@52969 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2022-05-10 16:12:08 +00:00
parent f7c8a72b6b
commit 0bb6a7c175
2 changed files with 2 additions and 2 deletions

View File

@ -3503,7 +3503,7 @@ function wp_filesize( $path ) {
return $size;
}
$size = (int) @filesize( $path );
$size = file_exists( $path ) ? (int) filesize( $path ) : 0;
/**
* Filters the size of the file.

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.0-RC1-53379';
$wp_version = '6.0-RC1-53380';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.