Make WordPress Core

Opened 21 months ago

Closed 21 months ago

Last modified 21 months ago

#62362 closed defect (bug) (duplicate)

Multiple PHP Warnings for "Undefined array key 'host'" and "Undefined array key 'scheme'," in wp-includes/canonical.php file

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

Description (last modified by sabernhardt)

I am trying to figure out what is going on on many of the WordPress websites I maintain. They are all up to date and on PHP 8.0 or higher. Here is an example of the PHP Warning I am getting in the error log. I don't want to make changes to the canonical.php file because it will simply be overwritten with the next WordPress core update. I'm trying to figure out if it is a WordPress core issue or a conflict with a theme or plugin. Although these websites have different themes and different plugins, which makes me suspect it might be a WordPress Core issue. Here is the Error:

[07-Nov-2024 17:10:26 UTC] PHP Warning:  Undefined array key "host" in /home/xxxxxxxx/public_html/wp-includes/canonical.php on line 716
[07-Nov-2024 17:10:26 UTC] PHP Warning:  Undefined array key "host" in /home/xxxxxxxx/public_html/wp-includes/canonical.php on line 727
[07-Nov-2024 17:10:26 UTC] PHP Warning:  Undefined array key "host" in /home/xxxxxxx/public_html/wp-includes/canonical.php on line 730
[07-Nov-2024 17:10:26 UTC] PHP Warning:  Undefined array key "scheme" in /home/xxxxxxx/public_html/wp-includes/canonical.php on line 751

Change History (5)

#1 @sabernhardt
21 months ago

  • Description modified (diff)

The same errors are listed in #62334. Is this the same issue?

#2 @designdata2013
21 months ago

It does look like the same issue, yes.

#3 @designdata2013
21 months ago

should I merge it with this other ticket?

#4 @ironprogrammer
21 months ago

  • Milestone Awaiting Review
  • Resolutionduplicate
  • Status newclosed
  • Version 6.6.2

Welcome to Trac, @designdata2013, and thanks for the report.

This issue is being tracked in #34353. IIRC, there is a challenge of isolating how to reproduce this issue outside specific environments (e.g. if it could be unit tested).

#5 in reply to: ↑ description @ketanniruke
21 months ago

You can use isset($arrayhost) to check this or add a default value to avoid warnings.

  1. Sometimes themes or plugins may not be fully compatible with PHP 8. Make sure all plugins and themes are updated to the latest version.

Replying to designdata2013:

I am trying to figure out what is going on on many of the WordPress websites I maintain. They are all up to date and on PHP 8.0 or higher. Here is an example of the PHP Warning I am getting in the error log. I don't want to make changes to the canonical.php file because it will simply be overwritten with the next WordPress core update. I'm trying to figure out if it is a WordPress core issue or a conflict with a theme or plugin. Although these websites have different themes and different plugins, which makes me suspect it might be a WordPress Core issue. Here is the Error:

[07-Nov-2024 17:10:26 UTC] PHP Warning:  Undefined array key "host" in /home/xxxxxxxx/public_html/wp-includes/canonical.php on line 716
[07-Nov-2024 17:10:26 UTC] PHP Warning:  Undefined array key "host" in /home/xxxxxxxx/public_html/wp-includes/canonical.php on line 727
[07-Nov-2024 17:10:26 UTC] PHP Warning:  Undefined array key "host" in /home/xxxxxxx/public_html/wp-includes/canonical.php on line 730
[07-Nov-2024 17:10:26 UTC] PHP Warning:  Undefined array key "scheme" in /home/xxxxxxx/public_html/wp-includes/canonical.php on line 751
Note: See TracTickets for help on using tickets.