Commit 3a64b0cbb2 for wordpress.org
commit 3a64b0cbb258328173bd989a031defdc0dfbcd5d
Author: SergeyBiryukov <sergeybiryukov@git.wordpress.org>
Date: Tue Nov 17 13:29:56 2026 +0000
Networks and Sites: Return a 404 from `ms-files.php` when no file is requested.
Returns the existing 404 before reading `$_GET['file']` when it's missing or not a string. This removes the “Undefined array key”, `str_replace()` null deprecation, and “Array to string conversion” warnings on line 33. Behavior is unchanged: those requests already end in a 404.
Developed in https://github.com/WordPress/wordpress-develop/pull/16068.
Follow-up to r12936, r60956.
Props bor0.
Fixes #66715.
Built from https://develop.svn.wordpress.org/trunk@65552
git-svn-id: http://core.svn.wordpress.org/trunk@64625 1a063a9b-81f0-0310-95a4-ce76da25c4cd
diff --git a/wp-includes/ms-files.php b/wp-includes/ms-files.php
index d17d9f95f7..497cc43e80 100644
--- a/wp-includes/ms-files.php
+++ b/wp-includes/ms-files.php
@@ -30,6 +30,11 @@ if ( ! defined( 'BLOGUPLOADDIR' ) ) {
die( '500 — Directory not configured.' );
}
+if ( ! isset( $_GET['file'] ) || ! is_string( $_GET['file'] ) ) {
+ status_header( 404 );
+ die( '404 — File not found.' );
+}
+
$file = rtrim( BLOGUPLOADDIR, '/' ) . '/' . str_replace( '..', '', $_GET['file'] );
if ( ! is_file( $file ) ) {
status_header( 404 );
diff --git a/wp-includes/version.php b/wp-includes/version.php
index 97fddeeac2..d6fe08f0ff 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
-$wp_version = '7.2-beta5-65551';
+$wp_version = '7.2-beta5-65552';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.