Make WordPress Core

Changeset 60956


Ignore:
Timestamp:
10/17/2025 05:12:10 PM (3 months ago)
Author:
johnjamesjacoby
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/ms-files.php

    r60170 r60956  
    2424    status_header( 404 );
    2525    die( '404 — File not found.' );
     26}
     27
     28if ( ! defined( 'BLOGUPLOADDIR' ) ) {
     29    status_header( 500 );
     30    die( '500 — Directory not configured.' );
    2631}
    2732
Note: See TracChangeset for help on using the changeset viewer.