diff --git a/src/wp-admin/includes/ms.php b/src/wp-admin/includes/ms.php
index 741d02e9c9..926a452018 100644
--- a/src/wp-admin/includes/ms.php
+++ b/src/wp-admin/includes/ms.php
@@ -30,7 +30,7 @@ function check_upload_size( $file ) {
 
 	$space_left = get_upload_space_available();
 
-	$file_size = filesize( $file['tmp_name'] );
+	$file_size = wp_filesize( $file['tmp_name'] );
 	if ( $space_left < $file_size ) {
 		/* translators: %s: Required disk space in kilobytes. */
 		$file['error'] = sprintf( __( 'Not enough space to upload. %s KB needed.' ), number_format( ( $file_size - $space_left ) / KB_IN_BYTES ) );
diff --git a/src/wp-admin/includes/plugin.php b/src/wp-admin/includes/plugin.php
index 3084312da5..894d161737 100644
--- a/src/wp-admin/includes/plugin.php
+++ b/src/wp-admin/includes/plugin.php
@@ -400,7 +400,7 @@ function get_mu_plugins() {
 		$wp_plugins[ $plugin_file ] = $plugin_data;
 	}
 
-	if ( isset( $wp_plugins['index.php'] ) && filesize( WPMU_PLUGIN_DIR . '/index.php' ) <= 30 ) {
+	if ( isset( $wp_plugins['index.php'] ) && wp_filesize( WPMU_PLUGIN_DIR . '/index.php' ) <= 30 ) {
 		// Silence is golden.
 		unset( $wp_plugins['index.php'] );
 	}
diff --git a/src/wp-includes/class-wp-customize-manager.php b/src/wp-includes/class-wp-customize-manager.php
index fe03a93c1e..0a55fd0c18 100644
--- a/src/wp-includes/class-wp-customize-manager.php
+++ b/src/wp-includes/class-wp-customize-manager.php
@@ -6046,7 +6046,7 @@ final class WP_Customize_Manager {
 	public function _validate_header_video( $validity, $value ) {
 		$video = get_attached_file( absint( $value ) );
 		if ( $video ) {
-			$size = filesize( $video );
+			$size = wp_filesize( $video );
 			if ( $size > 8 * MB_IN_BYTES ) {
 				$validity->add(
 					'size_too_large',
diff --git a/src/wp-includes/ms-files.php b/src/wp-includes/ms-files.php
index 6fb7e4d276..7695c28c84 100644
--- a/src/wp-includes/ms-files.php
+++ b/src/wp-includes/ms-files.php
@@ -42,7 +42,7 @@ if ( $mime['type'] ) {
 
 header( 'Content-Type: ' . $mimetype ); // Always send this.
 if ( false === strpos( $_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS' ) ) {
-	header( 'Content-Length: ' . filesize( $file ) );
+	header( 'Content-Length: ' . wp_filesize( $file ) );
 }
 
 // Optional support for X-Sendfile and X-Accel-Redirect.
diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php
index 423347a721..fc3ffd8f10 100644
--- a/src/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php
+++ b/src/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php
@@ -1284,7 +1284,7 @@ class WP_REST_Attachments_Controller extends WP_REST_Posts_Controller {
 
 		$space_left = get_upload_space_available();
 
-		$file_size = filesize( $file['tmp_name'] );
+		$file_size = wp_filesize( $file['tmp_name'] );
 
 		if ( $space_left < $file_size ) {
 			return new WP_Error(
diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-edit-site-export-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-edit-site-export-controller.php
index 691760812b..ddfc421cb2 100644
--- a/src/wp-includes/rest-api/endpoints/class-wp-rest-edit-site-export-controller.php
+++ b/src/wp-includes/rest-api/endpoints/class-wp-rest-edit-site-export-controller.php
@@ -85,7 +85,7 @@ class WP_REST_Edit_Site_Export_Controller extends WP_REST_Controller {
 		$theme_name = basename( get_stylesheet() );
 		header( 'Content-Type: application/zip' );
 		header( 'Content-Disposition: attachment; filename=' . $theme_name . '.zip' );
-		header( 'Content-Length: ' . filesize( $filename ) );
+		header( 'Content-Length: ' . wp_filesize( $filename ) );
 		flush();
 		readfile( $filename );
 		unlink( $filename );
diff --git a/src/wp-includes/script-loader.php b/src/wp-includes/script-loader.php
index 1c1d12a367..bb9e39cb50 100644
--- a/src/wp-includes/script-loader.php
+++ b/src/wp-includes/script-loader.php
@@ -2828,7 +2828,7 @@ function wp_maybe_inline_styles() {
 				'handle' => $handle,
 				'src'    => $wp_styles->registered[ $handle ]->src,
 				'path'   => $wp_styles->registered[ $handle ]->extra['path'],
-				'size'   => filesize( $wp_styles->registered[ $handle ]->extra['path'] ),
+				'size'   => wp_filesize( $wp_styles->registered[ $handle ]->extra['path'] ),
 			);
 		}
 	}
