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.
Fixes #55678.
See #49412.

Built from https://develop.svn.wordpress.org/trunk@53372


git-svn-id: http://core.svn.wordpress.org/trunk@52961 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Peter Wilson 2022-05-10 05:02:11 +00:00
parent 6aa2e2c123
commit 8545c4493b
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.1-alpha-53371';
$wp_version = '6.1-alpha-53372';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.