Files
wordpress/wp-includes
johnjamesjacoby ff31fa4b12 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.
Built from https://develop.svn.wordpress.org/trunk@61136


git-svn-id: http://core.svn.wordpress.org/trunk@60472 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2025-11-04 18:31:29 +00:00
..
2025-11-04 12:36:42 +00:00
2025-11-04 12:36:42 +00:00
2025-11-04 12:36:42 +00:00
2025-10-21 15:59:33 +00:00