-
Notifications
You must be signed in to change notification settings - Fork 823
Boost: Fix sprintf function call compatibility with Gutenberg 21.2 #44418
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
Conversation
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 Follow this PR Review Process:
If you have questions about anything, reach out in #jetpack-developers for guidance! Boost plugin: No scheduled milestone found for this plugin. If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. |
Code Coverage SummaryCoverage changed in 1 file.
|
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.
Confirmed the bug and that this patch resolves it.
I'm going to go ahead and merge this so |
This is the only culprit of this specific issue I found, though if I encounter any further ones, will do! |
Fixes HOG-219: Cornerstone pages UI broken when Gutenberg plugin is active
Proposed changes:
Other information:
Jetpack product discussion
N/A
Does this pull request change what data or activity we track or use?
No
Testing instructions:
Compatibility Testing:
Background
Root Cause: The issue was caused by incorrect usage of
sprintf()
where we passed an anonymous function as the second argument instead of calling the function first.Why it worked before: WordPress core and Gutenberg ≤21.1.1 used the sprintf-js library that would automatically execute function arguments via its computed values functionality.
What changed: Gutenberg 21.2 updated their
@wordpress/i18n
implementation to use a standards-compliantsprintf
that doesn't execute function arguments, causing the function code to be displayed as text. (WordPress/gutenberg#70434)The fix: Changed from
sprintf(template, functionRef)
tosprintf(template, functionRef())
to ensure we pass the actual value instead of the function reference.