Skip to content

Commit fe1719b

Browse files
committed
Networks and Sites: check if the BLOGUPLOADDIR constant is defined before using it.
This change prevents a fatal PHP error from occurring when `ms-files.php` is accessed without legacy multisite file-handling support being configured. Instead of the fatal error, these same requests will new return a header status `500` along with a `die()` message "500 - Directory not configured." This differs from the existing `404` statuses to help indicate to site owners this fallback is not working as intended. Props danielpw, dd32, jakeparis, johnjamesjacoby, spacedmonkey, saurabh.dhariwal, sukhendu2002, realloc. Fixes #63104. git-svn-id: https://develop.svn.wordpress.org/trunk@60956 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 9870028 commit fe1719b

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/wp-includes/ms-files.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@
2525
die( '404 — File not found.' );
2626
}
2727

28+
if ( ! defined( 'BLOGUPLOADDIR' ) ) {
29+
status_header( 500 );
30+
die( '500 — Directory not configured.' );
31+
}
32+
2833
$file = rtrim( BLOGUPLOADDIR, '/' ) . '/' . str_replace( '..', '', $_GET['file'] );
2934
if ( ! is_file( $file ) ) {
3035
status_header( 404 );

0 commit comments

Comments
 (0)