From 0bb6a7c17536d605b69003cf5025372d228ca50c Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Tue, 10 May 2022 16:12:08 +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, 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 --- wp-includes/functions.php | 2 +- wp-includes/version.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 88d210bbd2..b4ea6fbce0 100644 --- a/wp-includes/functions.php +++ b/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. diff --git a/wp-includes/version.php b/wp-includes/version.php index b3e12640e8..d92c639a57 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -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.