Make WordPress Core

#58162 closed defect (bug) (duplicate)

Undefined array key PHP Warnings

Reported by: onlanka's profile onlanka Owned by:
Milestone: Priority: normal
Severity: major Version: 6.2
Component: Canonical Keywords:
Focuses: Cc:

Description

Recently I upgraded my server's PHP version from 7.4 to 8.1.

Now I'm getting following error lines in the error_log file.

[18-Apr-2023 07:13:55 UTC] PHP Warning:  Undefined array key "00" in /some_path/public_html/wp-includes/class-wp-locale.php on line 319
[18-Apr-2023 07:57:56 UTC] PHP Warning:  Undefined array key "path" in /some_path/public_html/wp-includes/canonical.php on line 592
[18-Apr-2023 14:20:18 UTC] PHP Warning:  Undefined array key "host" in /some_path/public_html/wp-includes/canonical.php on line 689
[18-Apr-2023 14:20:18 UTC] PHP Warning:  Undefined array key "host" in /some_path/public_html/wp-includes/canonical.php on line 698
[18-Apr-2023 14:20:18 UTC] PHP Warning:  Undefined array key "host" in /some_path/public_html/wp-includes/canonical.php on line 701
[18-Apr-2023 14:20:18 UTC] PHP Warning:  Undefined array key "scheme" in /some_path/public_html/wp-includes/canonical.php on line 722

And also following errors were found:

[18-Apr-2023 21:51:53 UTC] PHP Warning:  Attempt to read property "post_content" on null in /some_path/public_html/wp-content/themes/boldr-lite/functions.php on line 267
[18-Apr-2023 21:51:53 UTC] PHP Warning:  Attempt to read property "post_content" on null in /some_path/public_html/wp-content/themes/boldr-lite/functions.php on line 268

But if I switch back to PHP 7.4, no error_log is reported.

If someone from WordPress needs to investigate, I can give access to my website privately.

Change History (2)

This ticket was mentioned in Slack in #core-test by ironprogrammer. View the logs.


11 months ago

#2 @ironprogrammer
11 months ago

  • Focuses coding-standards removed
  • Keywords needs-patch removed
  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Welcome back to Trac, @onlanka, and thanks for the report!

This issue appears to be tracked already in #34353 (see the latest comments that reference warnings in PHP 8+).

Note: See TracTickets for help on using tickets.