Fix GitHub Actions failure due to duplicate functions#44052
Fix GitHub Actions failure due to duplicate functions#44052noisysocks merged 3 commits intotrunkfrom
Conversation
wp_add_global_styles_for_blocks|
I'm not sure but the Could you please check it again? Thank you |
|
My understanding is that the performance test will not pass the test unless it is merged because trunk is also used. |
amustaque97
left a comment
There was a problem hiding this comment.
I tested your changes locally (I tried in my fork version but it was a bit complex on Github so I left it there 😅 ). Performance test step doesn't throw any re-declaration exceptions now. ➕ 🚀
andrewserong
left a comment
There was a problem hiding this comment.
Thanks for looking into a fix @t-hamano! For this function, I'm wondering if instead we should be using a gutenberg prefixed version instead of attempting to use the version that's just been merged into core?
| if ( ! function_exists( 'wp_add_global_styles_for_blocks' ) ) { | ||
| /** | ||
| * Adds global style rules to the inline style for each block. | ||
| */ | ||
| function wp_add_global_styles_for_blocks() { |
There was a problem hiding this comment.
Instead of checking whether or not the core wp_add_global_styles_for_blocks exists, should we instead rename the function to gutenberg_add_global_styles_for_blocks so that in the plugin, we're always calling the Gutenberg version? This would make it similar to the function lower down in this file (gutenberg_get_global_stylesheet).
| if ( ! function_exists( 'wp_add_global_styles_for_blocks' ) ) { | ||
| wp_add_global_styles_for_blocks(); | ||
| } |
There was a problem hiding this comment.
This check appears to call the function only if it doesn't exist.
Instead, should we use a gutenberg prefixed version of the function?
|
Thanks for the review, @andrewserong ! |
andrewserong
left a comment
There was a problem hiding this comment.
Thanks for following up @t-hamano, this looks good to me, and styles appear to be output correctly on my test site.
Now we just need someone with access to merge this in 😄
|
Thanks for merging, @noisysocks! 🙇 |
|
Thank you for addressing, @t-hamano and @andrewserong! Here's some more discussion on the issue: WordPress/wordpress-develop#3206 (comment) |
|
I'm going to release GB 14.0.3 in a bit to include this fix, in order to make it possible to run GB stable against Core |
* Add redeclaration check of `wp_add_global_styles_for_blocks` * Add skip redirection * Use gutenberg_ prefix
What?
This PR checks for redeclarations in the
wp_add_global_styles_for_blocksfunction and resolves Fatal errors in gitHub Actions.In some actions, the following Fatal Error occurs:
Why?
A backport was done on Changeset 54118 in WordPress core and
wp_add_global_styles_for_blockswas added.I believe this problem occurred because the function is not checked on the Gutenberg.
How?
I followed this best practice and added checks by
function_exists.Testing Instructions
In this PR, confirm that all tests pass.Confrim that all tests pass, except for the performance test where trunk is used.