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

Plugin: Fix fatal error for older WP/PHP versions #40538

Merged
merged 1 commit into from Apr 22, 2022

Conversation

Mamaduka
Copy link
Member

What?

Resolves #40508.

PR fixes a fatal error when running the plugin with WP 5.8 and PHP < 8.0.

Why?

Plugin started using new string functions, core polyfills them since WP 5.9, but we forgot to add polyfills for older versions. Gutenberg still supports 5.8.

Files using new functions:

  • lib/compat/wordpress-6.0/block-editor-settings.php
  • lib/experimental/register-webfonts-from-theme-json.php

How?

Added polyfills in WordPress 5.9 compat folder.

Testing Instructions

  1. Confirm you're running PHP < 8.0
  2. Downgrade WP to 5.8.x - wp core update --version=5.8.3 --force
  3. Place this function call somewhere in plugin's core for easy testing - str_contains( 'abc', 'a' );
  4. PHP shouldn't trigger fatal error.

@Mamaduka Mamaduka self-assigned this Apr 22, 2022
@Mamaduka Mamaduka added [Type] Bug An existing feature does not function as intended Backwards Compatibility Issues or PRs that impact backwards compatability labels Apr 22, 2022
Copy link
Contributor

@hellofromtonya hellofromtonya left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@Mamaduka Mamaduka merged commit 0bb230c into trunk Apr 22, 2022
@Mamaduka Mamaduka deleted the fix/wp-5.8-compatibility branch April 22, 2022 10:14
@github-actions github-actions bot added this to the Gutenberg 13.2 milestone Apr 22, 2022
@Mamaduka
Copy link
Member Author

Thanks for the review, @hellofromtonya.

@glendaviesnz, can we cherry-pick this for Gutenberg 13.1?

@glendaviesnz
Copy link
Contributor

@glendaviesnz, can we cherry-pick this for Gutenberg 13.1?

Have moved to the 13.1 milestone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backwards Compatibility Issues or PRs that impact backwards compatability [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Hard error on WP5.8 on PHP<8 using gutenberg plugin
3 participants