From f42475145fe4af3a49ee72d3749c879c4b206835 Mon Sep 17 00:00:00 2001 From: Peter Wilson Date: Tue, 10 May 2022 05:00:15 +0000 Subject: [PATCH] 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 --- src/wp-includes/functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wp-includes/functions.php b/src/wp-includes/functions.php index 88d210bbd2..b4ea6fbce0 100644 --- a/src/wp-includes/functions.php +++ b/src/wp-includes/functions.php @@ -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.