Make WordPress Core

Opened 3 weeks ago

Closed 22 hours ago

#62245 closed defect (bug) (duplicate)

ErrorException: Warning: Undefined array key "host"

Reported by: jhobden600's profile jhobden600 Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Canonical Keywords:
Focuses: Cc:

Description

Occasionally I see in the logs the $original['host'] value is undefined on line 716 in wp-includes/canonical.php. I'm not sure if it's bots, or a local script triggering this error, but it seems to be possible on occasion for the array key 'host' to be missing.

Either way, there should be a check that the value of $original['host'] isset, before proceeding. I suggest

if (!isset($original['host'])){
    $original['host'] = '';
}

is added on line 715 in wp-includes/canonical.php to prevent the warning.

PHP version 8.3.6. Using latest WordPress version 6.6.2.

Change History (2)

#2 @ironprogrammer
22 hours ago

  • Component changed from General to Canonical
  • Focuses coding-standards php-compatibility removed
  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Welcome to Trac, @jhobden600, and thanks for the report!

This issue is being tracked over in #34353, where you are invited to help move this forward.

Note: See TracTickets for help on using tickets.