Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patterns: Fix PHP warning in categories REST API controller #45410

Merged
merged 2 commits into from
Oct 31, 2022

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.

2 participants