-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Fix fatal error by checking if block_type asset properties are set #46488
Conversation
@noahtallen Were you able to identify the commit or PR that introduced these properties initially? We might want to ask the author to provide compatibility with 6.0 for it. |
@youknowriad I think it was added in #44298, which @ellatrix worked on (and I think you collaborated on) We may try to release a patch fix here in the meantime so that we can resolve the fatal error |
83d8114
to
789039a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍🏻
Apologies for polluting trunk with multiple commits -- I thought that it would squash merge :/ |
What?
We've noticed the following fatal error with Gutenberg 14.71, which would be great to resolve in a patch release quickly! Please merge this while I'm offline and create a path release if it looks like a reasonable approach! Or if you have a better idea, overwrite this branch or make a new PR with it! Since it's a fatal error, it'd be nice to not get blocked on async reviews ;)
This adds some safeguards in case these values are not defined or null (
isset
). Since these new asset properties were introduced in 6.1, they won't work in 6.0.Question: why is the 6.2 compat lib loaded for WordPress 6.0??This was answered for me: 6.2 compat lib is loaded to provide compatibility with 6.2 Gutenberg features to older WordPress versions.
Why?
To fix the fatal.
How?
Check if properties
isset
, and use an empty array if not.Testing Instructions
Set your
.wp-env.override.json
file to this to get PHP 8 and WP 6.0Checkout the current Gutenberg release locally:
git checkout tags/v14.7.1
.If you build the Gutenberg plugin and start wp-env, the page will crash trying to edit a post. If you apply the change in this PR, you should be able to edit the post.
Testing Instructions for Keyboard
Screenshots or screencast
demo of fix:
Screen.Recording.2022-12-13.at.1.29.33.PM.mov