Make WordPress Core

Changeset 60226


Ignore:
Timestamp:
05/07/2025 07:45:31 PM (8 months ago)
Author:
SergeyBiryukov
Message:

Bootstrap/Load: Check if HTTP_HOST is defined when determining the current site.

This avoids a PHP warning when running cron via CLI on Multisite:

Warning: Undefined array key "HTTP_HOST" in wp-includes/ms-settings.php on line 62

Follow-up to mu:11, mu:423, mu:543, [12602], [27359].

Props Mte90, JochenT, walterebert, elialum, SergeyBiryukov.
Fixes #47733.

File:
1 edited

Legend:

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

    r59688 r60226  
    6060if ( ! isset( $current_site ) || ! isset( $current_blog ) ) {
    6161
    62     $domain = strtolower( stripslashes( $_SERVER['HTTP_HOST'] ) );
     62    $domain = strtolower( stripslashes( $_SERVER['HTTP_HOST'] ?? '' ) );
    6363    if ( str_ends_with( $domain, ':80' ) ) {
    6464        $domain               = substr( $domain, 0, -3 );
Note: See TracChangeset for help on using the changeset viewer.