Fix fatal error by checking if block_type asset properties are set#46488
Merged
noahtallen merged 7 commits intotrunkfrom Dec 14, 2022
Merged
Fix fatal error by checking if block_type asset properties are set#46488noahtallen merged 7 commits intotrunkfrom
noahtallen merged 7 commits intotrunkfrom
Conversation
Contributor
|
@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. |
Member
Author
|
@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
Member
Author
|
Apologies for polluting trunk with multiple commits -- I thought that it would squash merge :/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.jsonfile to this to get PHP 8 and WP 6.0{ "core": "https://wordpress.org/wordpress-6.0.zip", "phpVersion": "8.0" }Checkout 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