[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
Wed Apr 23 00:04:23 UTC 2025


#63316: [E_WARNING] Undefined array key "host" in wp-includes/canonical.php on line
717
------------------------------+------------------------------
 Reporter:  ArtZ91            |       Owner:  (none)
     Type:  defect (bug)      |      Status:  new
 Priority:  normal            |   Milestone:  Awaiting Review
Component:  Canonical         |     Version:  6.8
 Severity:  normal            |  Resolution:
 Keywords:  has-testing-info  |     Focuses:
------------------------------+------------------------------
Changes (by SirLouen):

 * keywords:  needs-testing-info => has-testing-info


Comment:

 == Bug Reproduction Report
 === Description
 ✅ This report validates that the issue can be reproduced.

 === Environment
 - WordPress: 6.9-alpha-60093-src
 - PHP: 8.2.28
 - Server: Apache/2.4.63 (Unix)
 - Database: mysqli (Server: 8.4.5 / Client: mysqlnd 8.2.28)
 - Browser: Chrome 135.0.0.0
 - OS: Windows 10/11
 - Theme: Minimal Child Theme 1.0.2
 - MU Plugins: None activated
 - Plugins:
   * Test Reports 1.2.0

 === Reproduction Steps

 1. First, you need a server that can accept requests without a Host. I
 tried to make Nginx do this, but could not find an easy solution. So the
 only alternative was to use Apache2 (this is
 [https://core.trac.wordpress.org/ticket/63316#comment:2 why I asked here
 for the environment vars], I had a suspicion that A2 was the culprit.

 2. Second, we need to make sure that Apache2 has the guard down. We need
 to set `HttpProtocolOptions Unsafe` for the `VirtualHost`

 3. Third, we should issue a request with very low standards. Like this
 one:
 {{{
 curl -v -k --http1.0 -H 'Host:' http://localhost:8889
 }}}

 Note that in my case I'm using the `wordpress-develop` build, with an
 slightly modified version to use Apache2 instead of Nginx

 If you want to run my config in wordpress-develop you can get my patch
 with
 `npm run grunt patch:https://github.com/WordPress/wordpress-
 develop/pull/8722`


 === Actual Results
 1.  ✅ Error condition occurs (reproduced).

 Here is the debug log that displays the same error that the reporter is
 reporting:
 https://gist.github.com/SirLouen/16ad44e99dbcf9ef7bd932663ba48e2f#file-
 debug-log

 === Additional Notes
 - Despite A2 being the culprit, I believe that this warning should be
 handled.
 - I'm not 100% confident that it feels that it's complex that this error
 happens in any modern well configured server, but as always, better safe
 than sorry.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/63316#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list