Repository navigation
Fix Feedzy RSS block fatal error with lazy loading (#165) - #169
Open
medgedecastro wants to merge 2 commits into
Open
medgedecastro wants to merge 2 commits into
medgedecastro wants to merge 2 commits into
Conversation
Widget Options registered extended_widget_opts and extended_widget_opts_block on every block with an (object)[] default. Feedzy's lazy-loading loop passes block attributes to esc_attr(), so the stdClass default caused "Object of class stdClass could not be converted to string", including when saving a page in the editor. - Register the two attributes on Feedzy blocks without a default, the same way Jetpack blocks are handled. - Wrap the Feedzy render_callback to remove the Widget Options attributes before Feedzy renders, which avoids "Array to string conversion" warnings when block options are set.
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.
Fixes #165
Summary
Fixes a compatibility issue with Feedzy RSS Feeds. A page with a Feedzy RSS block and lazy loading enabled fails with
Object of class stdClass could not be converted to stringwhile Widget Options is active. The same fatal blocks saving the page in the editor.Cause
Widget Options registers
extended_widget_optsandextended_widget_opts_blockon all blocks with(object)[]defaults. Feedzy's lazy-load loop (feedzy-rss-feeds-admin-abstract.php, around lines 451-463) only callsimplode()on arrays, then passes every other value toesc_attr(). AstdClassdefault therefore causes a fatal.Changes
includes/widgets/gutenberg/gutenberg-toolbar.phpfeedzy) now register the two attributes without a default, like the existing Jetpack branch.render_callbackthat removesextended_widget_optsandextended_widget_opts_blockbefore Feedzy renders. This avoids "Array to string conversion" warnings and stops Widget Options data from being added to Feedzy's lazy-loaddata-*attributes.