Make WordPress Core

Opened 2 years ago

Closed 2 years ago

#62245 closed defect (bug) (duplicate)

ErrorException: Warning: Undefined array key "host"

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

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
2 years ago

  • Component General → Canonical
  • Focuses coding-standards php-compatibility removed
  • Milestone Awaiting Review
  • Resolution → duplicate
  • Status new → 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.