Make WordPress Core

Opened 6 months ago

Last modified 6 months ago

#63756 new defect (bug)

Undefined array key "slug" in /wp-includes/class-wp-theme-json.php on line 3264

Reported by: merax's profile MeraX Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 5.8
Component: Themes Keywords: has-patch
Focuses: template Cc:

Description

Hi there, I'm running WordPress 6.8.2 with a child theme of Twenty Twenty-Three. I've been tuning colors and other theme settings with the generic WordPress site-editor (Gutenberg). I'm not sure when the following warning started to appear in my longs, but now I'm having plenty of the following warnings in my log:

PHP message: PHP Warning: Undefined array key "slug" in [...]/wp-includes/class-wp-theme-json.php on line 3264;

It appears to me that there is a discrepancy between my theme.json and that code. However, my theme.json was only changed through the official editor. Unfortunately, I'm unable to recall all the steps I did.

Nonetheless, I would propose adding a isset( $item['slug'] ) check before accessing it in the code that is raising the above warning.

I've prepared a path on GitHub.

Change History (2)

This ticket was mentioned in PR #9330 on WordPress/wordpress-develop by MeraX.


6 months ago
#1

This fixes the following warning spamming my logs:

PHP message: PHP Warning: Undefined array key "slug" in [...]/wp-includes/class-wp-theme-json.php on line 3264;

It appears to me that there is a discrepancy between my theme.json and that code. However, my theme.json was only changed through the official editor. Unfortunately, I'm unable to recall all the steps I did.

Nonetheless, I would propose adding a isset( $itemslug? ) check before accessing it in the code that is raising the above warning.

#2 @westonruter
6 months ago

  • Type changed from enhancement to defect (bug)
  • Version changed from 6.8.2 to 5.8
Note: See TracTickets for help on using tickets.