Skip to content

Commit eb96a2e

Browse files
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 [https://mu.trac.wordpress.org/changeset/11 mu:11], [https://mu.trac.wordpress.org/changeset/423 mu:423], [https://mu.trac.wordpress.org/changeset/543 mu:543], [12602], [27359]. Props Mte90, JochenT, walterebert, elialum, SergeyBiryukov. Fixes #47733. git-svn-id: https://develop.svn.wordpress.org/trunk@60226 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 163836d commit eb96a2e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/wp-includes/ms-settings.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
// have not been populated in the global scope through something like `sunrise.php`.
6060
if ( ! 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 );
6565
$_SERVER['HTTP_HOST'] = substr( $_SERVER['HTTP_HOST'], 0, -3 );

0 commit comments

Comments
 (0)