Make WordPress Core

Opened 3 hours ago

Last modified 2 hours ago

#63756 new enhancement

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: 6.8.2
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 (1)

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


2 hours 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.

Note: See TracTickets for help on using tickets.