Tracking PHP 8 issues around WordPress

This site runs on PHP 8rc1, WordPress trunk and Gutenberg from Master. On this page, I track the issues, I had seen on this site. If you want a big picture kind of report, I recommend reading Yoast’s The 2020 WordPress and PHP 8 compatibility report.

WordPress Core team also posted a Call for testing: PHP 8.0

“The state of PHP 8 support within the broader ecosystem (plugins, themes, etc.) is impossible to know. For that reason, WordPress 5.6 should be considered ‘beta compatible’ with PHP 8.

Jonathan Derosiers, WordPress Core Team

WordPress Core

I tracked two PHP8 issues:

  1. [php8] TypeError: call_user_func_array(): non-static method WP_Feed_Cache::create() cannot be called statically
  2. [PHP8] Uncaught TypeError: array_flip():

The error message in the first one mentioned the plugin wordpress-beta-tester and I connected with Andy Fragen to test his patch for core. Fixed this for this site. However, because it’s on trunk, the core file changes are overwritten every day and the error message in the Dashboard comes back. It’s flagged for 5.6 but it doesn’t seem to be committed yet. So I now have the two core files that have the changes on local and FTP it to the site, whenever I feel I can’t tolerate that error message any more<g>

For the second trac ticket, I didn’t have a reference to which plugin caused the error message. Juliette gave a few hints to further troubleshoot these kinds of error messages. Robert Anderson noted that there is a Gutenberg patch that fixed it.

So, this gave me an opportunity to test how a stable release of Gutenberg from the WordPress repo and the upload of a zip from master interact.

Plugins

A week earlier, I did tract down the two plugins causing error messages.

Jetpack

Jetpack triggers a warning on all admin pages:
Only the first byte will be assigned to the string offset in /wp-includes/class.wp-scripts.php on line 492

And some weird changes in the Editor screen related to the table block showed up. I reported it without being able to give them additional information. Today, I installed the Jetpack 9.0.2 version again and now I see an error message in the browser console.

After testing, I removed the plugin again.

Yoast

The wordpress-seo plugin caused a fatal error on this site.

Fatal error: Uncaught ArgumentCountError: array_merge() does not accept unknown named parameters in /wp-content/plugins/wordpress-seo/admin/class-admin-editor-specific-replace-vars.php:223

I reported this issue on their GitHub repository and just don’t go to the plugin’s admin pages to stay out of trouble.

I am grateful for the Recovery Mode, now built into WordPress Core as well as the Health Check & Troubleshooting plugin by fellow contributors.

Troubleshooting Tips

Seems for those four cases, it was plugins that caused those errors. Sometimes, it seems, like in case number 2, the error message doesn’t supply us with a hint toward the plugin/theme/core file where the error is caused. Julliette Reinders Folmer had some instructions for me how to help with the detective work.

If you encounter PHP8 related error messages or warnings, you can review the All tickets filed for php8 on WordPress trac to avoid duplicates. If there is one that fits your issues description, add your information as well.

This is not necessarily an issue with WP Core, but more likely an issue with a plugin or theme doing it wrong.

Juliette Reinders Folmer
  • Gather some more information either by using the Query Monitor or by using the Debug Bar Actions & Filter addon.
  • To figure out which plugin/theme/Core is causing the issue, we need to know what functions are hooked into the respective filter and where they are coming from (plugin/theme/Core) and
  • if plugin/theme, preferably including information on which version of the plugin/theme you are using.

More WordPress + PHP8 Resources:

WordPress and PHP 8.0 by JJonathan Desrosiers for WordPress Core team.

Getting Your WordPress Plugins and Themes Ready for PHP 8 by Jonathan Bossenger on WPTavern

48 changes to core PHP that break backwards compatibility (PHP

Featured image: Cropped and posterized version of a photo by Ali Hajian on Unsplash

Published
Categorized as PHP 8

By Birgit Pauli-Haack

web + mobile strategist & coder 4 nonprofits. #nptech #WordPress - @gutenbergtimes host Gutenberg Changelog podcast https://apple.co/2Xece9H biz @paulisystems

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.