[wp-trac] [WordPress Trac] #63316: [E_WARNING] Undefined array key "host" in wp-includes/canonical.php on line 717
WordPress Trac
noreply at wordpress.org
Tue Nov 4 18:29:51 UTC 2025
#63316: [E_WARNING] Undefined array key "host" in wp-includes/canonical.php on line
717
-------------------------------------------------+-------------------------
Reporter: ArtZ91 | Owner:
| johnjamesjacoby
Type: defect (bug) | Status: closed
Priority: normal | Milestone: 6.9
Component: Canonical | Version: 2.3
Severity: minor | Resolution: fixed
Keywords: has-test-info has-patch dev- | Focuses:
feedback has-unit-tests commit |
-------------------------------------------------+-------------------------
Changes (by johnjamesjacoby):
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"61136" 61136]:
{{{
#!CommitTicketReference repository="" revision="61136"
Canonical: prevent "Undefined array key" PHP warnings when `host` is not
set.
This change is necessary to prevent scanning tools from polluting
debug/error logs of some hosting configurations with PHP warnings simply
by omitting the Host header from their requests.
This commit makes sure that all of the required `host`, `path`, `query`,
and `scheme` array keys inside of the `redirect_canonical()` function are
always set after various operations have been performed on them.
It also includes 1 new test case and 2 additional tests, to verify the
problem and its fix are working as intended, as well as a small
modification to the `get_canonical()` phpunit helper specifically to
account for `HTTP_HOST` maybe not being set.
Props artz91, johnjamesjacoby, mindctrl, sirlouen.
Fixes #63316.
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/63316#comment:32>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list