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

Fatal error: Cannot declare class WP_Block_Styles_Registry, because the name is already in use #17444

Closed
imabug opened this issue Sep 15, 2019 · 14 comments
Labels
Needs Technical Feedback Needs testing from a developer perspective. [Priority] High Used to indicate top priority items that need quick attention [Type] Bug An existing feature does not function as intended

Comments

@imabug
Copy link

imabug commented Sep 15, 2019

Describe the bug
After my Wordpress installation updated to WordPress 5.3-alpha-46118 overnight, I found that my blog wasn't working anymore. Managed to make my way to a recovery mode where I was informed that Gutenberg (6.4.0) had not activated properly. Deactivated Gutenberg, and when I tried to activate it again, I got the following error

Fatal error: Cannot declare class WP_Block_Styles_Registry, because the name is already in use in /home/eugenemah/v16.imablog.net/wp-content/plugins/gutenberg/lib/class-wp-block-styles-registry.php on line 14

Same thing when I deleted Gutenberg, reinstalled, and tried to reactivate

Had been working fine under the previous alpha version (don't recall what number that was)

One of my other blogs still running Wordpress 5.2.3 is still operating normally.

To reproduce
Steps to reproduce the behavior:

  1. Go to 'Plugins'
  2. Click on 'Activate' under the Gutenberg plugin
  3. See error

Expected behavior
Gutenberg plugin is activated

Desktop (please complete the following information):

  • OS: LInux 4.14.117-grsec-grsec+ (Dreamhost)
  • Browser: Chrome-dev
  • Version: 78.0.3904.9
@swissspidy swissspidy added [Type] Bug An existing feature does not function as intended Needs Technical Feedback Needs testing from a developer perspective. [Priority] High Used to indicate top priority items that need quick attention labels Sep 16, 2019
@youknowriad
Copy link
Contributor

This is already fixed in the plugin, it will be released with Gutenberg 6.5

@gziolo
Copy link
Member

gziolo commented Sep 19, 2019

Technically speaking, WordPress 5.3 will require Gutenberg 6.5+. This is not only to fix this bug, but in general to ensure that the version shipped with WordPress isn't overridden with the older version of the plugin :)

@mapk
Copy link
Contributor

mapk commented Nov 13, 2019

This just happened to me with the auto update to WordPress 5.3 that I have on one of my site. My plugin was out of date and it completely crashed my entire site. Using WP recovery tool helped resolve it.

@gziolo
Copy link
Member

gziolo commented Nov 13, 2019

@mcsf and @youknowriad - I think this will happen for all websites that have Gutenberg version which declares WP_Block_Styles_Registry without a guard check. @jorgefilipecosta might have a better idea which versions of the plugin will break with WordPress 5.3.

@youknowriad
Copy link
Contributor

If I remember properly. Versions prior to 6.6 are not compatible with WordPress 5.3

@mcsf
Copy link
Contributor

mcsf commented Nov 13, 2019

@pento, in the past we worked on #11375. Do you think we should look at a similar thing?

@pento
Copy link
Member

pento commented Nov 13, 2019

Aye, it seems like there should be a WP 5.3.1 fix that disables older Gutenberg versions.

Defensive coding practices in Gutenberg would be a more reliable option going forward. When defining a new class or function that will ultimately land in Core (if it doesn't have gutenberg_ prefix, assume it will land in Core at some point), it should include a class_exists() check from the beginning.

I'm not sure if there's a way to automate a check for this in PRs: @jrfnl may have an idea?

@mapk: Do you recall if your entire site was unavailable (eg, visiting a published post showed an error), or if it was just wp-admin? If it was the former, that seems like a bug in the fatal error protection in Core, too.

@jorgefilipecosta
Copy link
Member

Disabling older versions of the plugin in WordPress 5.3.1 seems like a good approach as WordPress 5.3 brings a more recent version of the editor anyway.
But I still wonder would it be possible to do a patch release on Gutenberg and would it get auto-updated?

@jorgefilipecosta
Copy link
Member

It seems the problem of the BlockStyles class affects versions 6.2, 6.3, 6.4.
But we have another problem where in versions 6.5 and 6.6 it is impossible to publish because of JS errors. It seems disabling is the best path to solve both problems.

@youknowriad
Copy link
Contributor

I've been on the forums these days, and this was not really something that was raised a lot compared to other issues (like jQuery => $). Gutenberg plugin is a developpement plugin these days and most users are on the recent versions. I think it's too overkill to do a 5.3.1 to disable these old plugins.

@mcsf
Copy link
Contributor

mcsf commented Nov 14, 2019

But we have another problem where in versions 6.5 and 6.6 it is impossible to publish because of JS errors. It seems disabling is the best path to solve both problems.

@jorgefilipecosta, can you detail this issue?

@jorgefilipecosta
Copy link
Member

@jorgefilipecosta, can you detail this issue?

Hi @mcsf,

There are some JS when we try to publish:

Publishing Failed.  Error Message: o is not a function.

@mrfoxtalbot
Copy link

mrfoxtalbot commented Nov 19, 2019

I have also encountered this same issue (Publishing Failed. Error Message: o is not a function. ) while working on https://gu10.blog and I was also able to solve it by disabling the plugin and working only with the 5.3 core version of Gutenberg.

That being said, it sounds like a conflict with some other (plugin) block, as I have not been able to reproduce the error on my testing site: https://gu10testing.wpcomstaging.com, on this site I can use the Gutenberg plugin and update my posts normally.

@joshhansen
Copy link

This just killed my site on upgrade to 5.3. If 5.3 depends on a particular plugin version in such a drastic manner, might it be made to check for that version prior to installation?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Technical Feedback Needs testing from a developer perspective. [Priority] High Used to indicate top priority items that need quick attention [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

10 participants