Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#55234 closed defect (bug) (duplicate)

PHP Notice: Undefined variable filters in WP_Theme_JSON::get_svg_filters()

Reported by: vladolaru's profile vlad.olaru Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Themes Keywords: has-patch
Focuses: Cc:

Description

If a block theme completely disables the color->duotone support in theme.json, by setting it to null, a PHP notice is generated:

Notice: Undefined variable: filters in /app/public/wp-includes/class-wp-theme-json.php on line 1620

This is due to the fact that the $filters variable gets initialized in the foreach only if a node is found with a non-empty duotone entry.

Change History (5)

This ticket was mentioned in PR #2347 on WordPress/wordpress-develop by vladolaru.


3 years ago
#1

  • Keywords has-patch added

#2 @vlad.olaru
3 years ago

Actually, besides the notice, the logic is also broken since $filters gets reset on each settings node with duotone.

#3 @mukesh27
3 years ago

  • Version trunk deleted

Hi there! thanks for the ticket and patch.

#55241 ticket has a similar solution as your PR and it was already marge in the core.

Let's ping @audrasjb for 2nd review.

Last edited 3 years ago by SergeyBiryukov (previous) (diff)

#4 @audrasjb
3 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Hello there, thanks @vladolaru for reporting this!

Thanks for checking @mukesh27, indeed we already fixed the issue in this ticket: #55241.

Thanks for the PR @vladolaru, I'll add a mention in #55241's final commit to branch 5.9 🙂

vladolaru commented on PR #2347:


3 years ago
#5

Closing this pull request since a similar fix was already merged in core. See: https://core.trac.wordpress.org/ticket/55234#comment:4

Note: See TracTickets for help on using tickets.