Skip to content

Conversation

@Mamaduka
Copy link
Member

What?

This is a follow-up to #45244.

PR fixes the PHP notice generated by Gutenberg_REST_Block_Pattern_Categories_Controller when the pattern category has no description.

 PHP Notice:  Undefined index: description in ~/gutenberg/lib/compat/wordpress-6.2/class-gutenberg-rest-block-pattern-categories-controller.php on line 32

How?

Add checks for the item key and fallbacks back to an empty string if it's not set.

Testing Instructions

  1. Enable debugging.
  2. Open a Post or Page.
  3. Confirm there's no notice generated.

@codesandbox
Copy link

codesandbox bot commented Oct 31, 2022

CodeSandbox logoCodeSandbox logo  Open in CodeSandbox Web Editor | VS Code | VS Code Insiders

@Mamaduka Mamaduka requested review from youknowriad and removed request for spacedmonkey October 31, 2022 06:58
@Mamaduka Mamaduka self-assigned this Oct 31, 2022
@Mamaduka Mamaduka added [Type] Bug An existing feature does not function as intended [Feature] Patterns A collection of blocks that can be synced (previously reusable blocks) or unsynced labels Oct 31, 2022
@Mamaduka Mamaduka merged commit d9eb36d into trunk Oct 31, 2022
@Mamaduka Mamaduka deleted the fix/patterns-category-controller-warning branch October 31, 2022 11:18
@github-actions github-actions bot added this to the Gutenberg 14.5 milestone Oct 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Feature] Patterns A collection of blocks that can be synced (previously reusable blocks) or unsynced [Type] Bug An existing feature does not function as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants