Make WordPress Core

#59584 closed defect (bug) (fixed)

Deactivate older versions of Gutenberg plugin when upgrading to WP 6.4

Reported by: hellofromtonya's profile hellofromTonya Owned by: hellofromtonya's profile hellofromTonya
Milestone: 6.4 Priority: normal
Severity: normal Version: 6.4
Component: Upgrade/Install Keywords: has-patch has-testing-info commit
Focuses: Cc:

Description

There are reports of older versions of Gutenberg plugin, i.e. <= 16.3.0, being incompatible with WP 6.4 which may cause broken sites or a fatal error.

Investigation / testing is needed to determine the minimum Gutenberg plugin version that is compatible with 6.4. If that minimum version is different than 14.1 (set in 6.1.1), then _upgrade_core_deactivate_incompatible_plugins() needs to be updated.

How to test:

  1. Use Core's trunk or the latest 6.4 Beta release.
  2. Install and activate an older version of the Gutenberg plugin, i.e. between versions 14.1 and 16.3 (possibly newer). How? Go to the plugin's Advanced View page, select the version to download in the Previous Versions section, and then select "Download" button. This version will need to be uploaded from your local testing Plugins UI.

Change History (17)

#1 @hellofromTonya
11 months ago

Findings:

Installing and activating Gutenberg 16.3.0 causes a fatal error during its activation:

PHP Fatal error: Access level to Gutenberg_REST_Global_Styles_Controller_6_2::validate_custom_css() must be protected (as in class WP_REST_Global_Styles_Controller) or weaker in /../public/wp-content/plugins/gutenberg/lib/compat/wordpress-6.2/class-gutenberg-rest-global-styles-controller-6-2.php on line 217

#2 @hellofromTonya
11 months ago

Findings

Installing and activating Gutenberg 16.4.0 causes a fatal error during its activation:

PHP Fatal error: Access level to Gutenberg_REST_Global_Styles_Controller_6_2::validate_custom_css() must be protected (as in class WP_REST_Global_Styles_Controller) or weaker in /../public/wp-content/plugins/gutenberg/lib/compat/wordpress-6.2/class-gutenberg-rest-global-styles-controller-6-2.php on line 217

#3 @hellofromTonya
11 months ago

Findings for Gutenberg 16.5.0:

Installing and activating Gutenberg 16.5.0 does NOT cause a fatal error during its activation.

Open and exploring the Site Editor - there are no errors in the browser's console.

#4 @hellofromTonya
11 months ago

  • Keywords needs-patch added

Given that Gutenberg 16.5.0 does not cause fatal errors or console errors, but 16.4.0 does, seems 16.5 is the new minimum version for 6.4. Patch incoming.

This ticket was mentioned in PR #5452 on WordPress/wordpress-develop by @hellofromTonya.


11 months ago
#5

  • Keywords has-patch added; needs-patch removed

Gutenberg (GB) plugin versions older than 16.5.0 are incompatible with WP 6.4 as noted in the ticket. For example, GB <= 16.4.0 causes a fatal error upon plugin activation. There is no fatal error with 16.5.0's activation or use.

This PR changes the minimum compatible version from 14.1 (since WP 6.1.1) to 16.5 within _upgrade_core_deactivate_incompatible_plugins().

Trac ticket: https://core.trac.wordpress.org/ticket/59584

#6 @hellofromTonya
11 months ago

  • Keywords has-testing-info added

Test Report

Scenario:
Test what happens when upgrading from WP 6.3.1 to WP 6.4 Beta 2 when an incompatible (16.4) or compatible (16.5) version of the Gutenberg plugin is activated.

Env:

  • Localhost: Local
  • WordPress: 6.3.1 and 6.4 Beta 2
  • OS: macOS
  • Webserver: nginx
  • Theme: default theme
  • Plugins:
    • Gutenberg versions 16.4 and 16.5
    • Beta Tester

Test Instructions

  1. Install WordPress 6.3.1.
  2. Download Gutenberg 16.4 from the wp . org plugin Advanced View UI:
    • Go to the plugin's Advanced View page.
    • Select the version to download in the Previous Versions section.
    • Select the "Download" button.
  3. Add the plugin's zip file by:
    • Go into your test site's admin area and navigate to Plugins > Add New > Upload Plugin.
    • Choose or drop and drag the zip file to the "Choose File" field.
    • Select the "Install Now" button.
  4. Then activate the plugin.
  5. Upgrade from WordPress 6.3.1 to 6.4 Beta 2. Instructions on how to upgrade are found in the announcement post (i.e. using wp-cli, Beta Tester plugin, etc.).
  6. After WordPress upgrades, notice the result.

Expected Results

When reproducing a bug:

  • An incompatible version such as GB 16.4 will cause a fatal error after WordPress upgrade to 6.4 Beta 1+ happens 🐞 ❌
  • A compatible version such as GB 16.5 will complete the upgrade process without an error ✅.

When testing the patch resolves the issue:

  • Plugin versions less than 16.5 are deactivated without an error ✅.


Reproduce Issue Test Results

Using Gutenberg 16.5

No fatal errors occurred.

The upgrade from 6.3.1 to 6.4 Beta 2 was successful.

Using Gutenberg 16.4

A fatal error is thrown during the upgrade process:

Fatal error: Access level to Gutenberg_REST_Global_Styles_Controller_6_2::validate_custom_css() must be protected (as in class WP_REST_Global_Styles_Controller) or weaker in /../public/wp-content/plugins/gutenberg/lib/compat/wordpress-6.2/class-gutenberg-rest-global-styles-controller-6-2.php on line 217

There has been a critical error on this website. Please check your site admin email inbox for instructions.

Learn more about troubleshooting WordPress.

#7 @hellofromTonya
11 months ago

Test Instructions

Steps to Reproduce

  • Step 2: Install Gutenberg v 16.4
  • Step 3: Activate Gutenberg plugin
  • Step 4: Update to WP 6.4 Beta 2+
    • Using WordPress Updates UI
      • In the admin area, go to Dashboard > Updates
      • Click/trigger the Update to version 6.4 Beta 2 button.
      • Update starts and then fails. 🐞 Bug occurs with a fatal error.
  • Step 5: Cleanup by deleting the Gutenberg plugin folder.

Notes:

  • Repeat the tests using any Gutenberg version less than 16.4. Same 🐞 fatal error.
  • Repeat the tests using Gutenberg version 16.5 or newer. ✅ Update succeeds with no fatal error.

Steps to Prepare WP zip file with fix:

Steps to Test the Fix

See how to do each step above.

  • Step 1: Install WP 6.3.1.
  • Step 2: Install Gutenberg v 16.4.
  • Step 3: Activate Gutenberg v 16.4.
  • Step 4: Update to WP 6.4 Beta 2 using the zip file
    wp core update --version=6.4 --force ../path/to/wordpress.zip
    
  • Step 5: Go to the Plugins UI.
    • Expected: Gutenberg plugin is deactivate ✅
    • Expected: No fatal error ✅

#8 @hellofromTonya
11 months ago

Contextual history:

#56985 had a similar issue during the 6.1 cycle which was resolved by [54790].

This ticket was mentioned in Slack in #core by hellofromtonya. View the logs.


11 months ago

#10 follow-up: @afragen
11 months ago

I’m actually surprised that this is a core function and it’s not in the Gutenberg plugin. Every other responsible plugin dev does their best to make compatibility checks and fix them.

#11 @hellofromTonya
11 months ago

  • Keywords commit added

The patch has an approval - thank you @spacedmonkey :) Marking this for commit. Getting it committed will make it easier to do follow-up testing.

#12 @hellofromTonya
11 months ago

  • Owner set to hellofromTonya
  • Resolution set to fixed
  • Status changed from new to closed

In 56820:

Update/Install: Deactivate Gutenberg plugin version older than 16.5.

This commit changes the Gutenberg minimum compatible version number from 14.1 (introduced in [54790]) to 16.5. For versions older than 16.5, the plugin will deactivate when upgrading WordPress to 6.4-beta3 or newer.

Changes are done within Core's _upgrade_core_deactivate_incompatible_plugins() which is invoked during WordPress' upgrade process.

Follow-up to [54790].

Props hellofromTonya, spacedmonkey.
Fixes #59584.

#14 @hellofromTonya
11 months ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

Re-opening to validate the behavior through test reports for 6.4 Beta 3 once it's released (happening within an hour). I'll then update the test instructions for testing it with 6.4 Beta 2 and 3.

#15 in reply to: ↑ 10 @hellofromTonya
11 months ago

Replying to afragen:

I’m actually surprised that this is a core function and it’s not in the Gutenberg plugin. Every other responsible plugin dev does their best to make compatibility checks and fix them.

True, though Gutenberg itself is the R&D for Core where new ideas are experimented with and new features developed and refined for somewhat continuous merging into Core. Over the years, guarding protection between the 2 have evolved. But still there are older versions that are incompatible due to lacking those or newer guarding protections.

So I think it's acceptable for Core to have a function to protect users and maintain their trust.

The function is written in a way that other large plugins could also be added to it should the need arise, again to protect users and maintain their trust of upgrading to the newest WP version.

#16 @antonvlasenko
11 months ago

Test Report

Patch tested: https://github.com/WordPress/wordpress-develop/pull/5452

Steps to Reproduce

  1. Install WordPress 6.3.1 (download from https://wordpress.org/download/releases/).
  2. Install and activate Gutenberg 16.5 (download from https://wordpress.org/plugins/gutenberg/advanced/).
  3. Update Core by running:
    wp core update --version=6.4-beta3
    

Expected Results

  • ✅ The WordPress update process should complete without console errors.

Actual Results

  • ✅ The WordPress update process completed without console errors.

Supplemental Artifacts

https://cldup.com/BOSt8aDTO3.png

#17 @hellofromTonya
11 months ago

  • Keywords needs-testing removed
  • Resolution set to fixed
  • Status changed from reopened to closed

Awesome. Thanks for confirming @antonvlasenko.

During the Beta 3 release party, I used Gutenberg 16.4 and then upgraded from WP 6.3.1 to 6.4 Beta 3. The plugin deactivated as expected.

Reclosing this issue as fixed.

Note: See TracTickets for help on using tickets.