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

Layout: Fix undefined index notice when attempting to check layout type #43756

Merged
merged 1 commit into from
Sep 1, 2022

Conversation

andrewserong
Copy link
Contributor

@andrewserong andrewserong commented Sep 1, 2022

What?

Fixes an issue introduced in: #43689

Add an additional isset() check before checking the layout type in layout.php to prevent a PHP notice about an undefined index

Why?

For blocks that don't have a type set, an undefined index notice is currently being output when rendering a post or page

How?

Add an additional isset() check to prevent the notice from being output

Testing Instructions

With TwentyTwentyTwo theme, go to view the site, and the PHP notices should not appear in debug.log with this PR applied.

Ensure that the fix from #43689 still appears to be working correctly.

Screenshots or screencast

Before, I was seeing lots of the following notice:

image

After, the notice should no longer be output.

@andrewserong andrewserong added [Type] Bug An existing feature does not function as intended Backport to Gutenberg Minor Release Pull request that needs to be backported to a Gutenberg minor release labels Sep 1, 2022
@andrewserong andrewserong self-assigned this Sep 1, 2022
Copy link
Contributor

@tellthemachines tellthemachines left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@priethor priethor merged commit 2de4197 into trunk Sep 1, 2022
@priethor priethor deleted the fix/layout-undefined-index-notice branch September 1, 2022 05:51
@github-actions github-actions bot added this to the Gutenberg 14.1 milestone Sep 1, 2022
priethor pushed a commit that referenced this pull request Sep 1, 2022
@priethor
Copy link
Contributor

priethor commented Sep 1, 2022

Thanks @andrewserong ! 🎉

Backported to the 14.0 branch in b8b6edb

@priethor priethor removed the Backport to Gutenberg Minor Release Pull request that needs to be backported to a Gutenberg minor release label Sep 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[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