[wp-trac] [WordPress Trac] #34353: redirect_canonical() – Undefined indexes 'host' and 'scheme'
WordPress Trac
noreply at wordpress.org
Tue Nov 5 13:16:13 UTC 2019
#34353: redirect_canonical() – Undefined indexes 'host' and 'scheme'
------------------------------------------+-----------------------------
Reporter: theamila | Owner: (none)
Type: defect (bug) | Status: reopened
Priority: normal | Milestone: Future Release
Component: Canonical | Version: 4.3.1
Severity: normal | Resolution:
Keywords: needs-patch needs-unit-tests | Focuses:
------------------------------------------+-----------------------------
Comment (by Cybr):
This notice happens because HTTP/1.0 doesn't fill the `HTTP_HOST` index in
`$_SERVER`. HTTP/1.1 and higher do support that index. Alas, around the
world, archaic browsers and servers are still using HTTP/1.0.
Because of that, `$requested_url` isn't populated, and `$original = @
parse_url( $requested_url );` won't have anything useful to parse, and
won't fill in the `host` index. Ergo, three notices will pop up when
trying to call `$original['host']`.
I think we can polyfill the `$_SERVER['HTTP_HOST']` index early. Doing so
would also address #47733. Be mindful of virtual hosts.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/34353#comment:21>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list