From 8545c4493b2d0630c041b4c42a296fa1631cebf2 Mon Sep 17 00:00:00 2001 From: Peter Wilson Date: Tue, 10 May 2022 05:02:11 +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. Built from https://develop.svn.wordpress.org/trunk@53372 git-svn-id: http://core.svn.wordpress.org/trunk@52961 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 ff42ceb795..3815928f02 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -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.