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.


git-svn-id: https://develop.svn.wordpress.org/trunk@53372 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Peter Wilson
2022-05-10 05:00:15 +00:00
parent fc4ac1f123
commit f42475145f

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.