Skip to content
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 in Site Logo block in WP 5.9 #36195

Merged
merged 1 commit into from Nov 5, 2021

Conversation

noisysocks
Copy link
Member

Description

Follows #34820.

Restore the _delete_site_logo_on_remove_custom_logo and _delete_site_logo_on_remove_theme_mods functions so that they exist when block-library/src/site-logo/index.php is copied to wp-includes/blocks/site-logo.php in Core for WP 5.9 (WordPress/wordpress-develop#1804).

This fixes a fatal error in WP 5.9 caused by calling add_action() with a callback that doesn't exist.

These functions were renamed to have a _gutenberg prefix in 0140ba0 to prevent an infinite loop, see https://github.com/WordPress/gutenberg/pull/34820/files#r710647763.

We can prevent the infinite loop using a global variable instead.

How has this been tested?

I haven't tested this. Maybe @stacimc, @andrewserong or @creativecoder can? 😀

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • I've tested my changes with keyboard and screen readers.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.
  • I've updated all React Native files affected by any refactorings/renamings in this PR (please manually search all *.native.js files for terms that need renaming or removal).

Restore the _delete_site_logo_on_remove_custom_logo functions
_delete_site_logo_on_remove_theme_mods so that they exist when
block-library/src/site-logo/index.php is copied to
wp-includes/blocks/site-logo.php in Core for WP 5.9.

These functions were renamed to have a _gutenberg prefix in
0140ba0 to prevent an infinite loop,
see https://github.com/WordPress/gutenberg/pull/34820/files#r710647763.

We can prevent an infinite loop using a global variable instead.
@noisysocks noisysocks added [Type] Bug An existing feature does not function as intended Gutenberg Plugin Issues or PRs related to Gutenberg Plugin management related efforts [Block] Site Logo Affects the Site Logo Block labels Nov 4, 2021
@noisysocks noisysocks added this to 👀 Needs review in WordPress 5.9 Must-Haves via automation Nov 4, 2021
Copy link
Contributor

@stacimc stacimc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this @noisysocks!

I checked out this branch and also manually copied changes over to the Core wp-includes/blocks/site-logo.php file in my local environment in order to test. I re-tested inserting, updating, and resetting Site Logos through the block and through the Customizer using the original testing instructions from #34820. All tested well for me!

@noisysocks
Copy link
Member Author

Thanks for testing!

@noisysocks noisysocks merged commit f01e9c5 into trunk Nov 5, 2021
WordPress 5.9 Must-Haves automation moved this from 👀 Needs review to ✅ Done Nov 5, 2021
@noisysocks noisysocks deleted the fix/fatal-error-in-site-logo-on-5.9 branch November 5, 2021 00:17
@github-actions github-actions bot added this to the Gutenberg 11.9 milestone Nov 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Site Logo Affects the Site Logo Block Gutenberg Plugin Issues or PRs related to Gutenberg Plugin management related efforts [Type] Bug An existing feature does not function as intended
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

2 participants