WordPress / health-check

Health Check is a WordPress plugin that will perform a number of checks on your WordPress install to detect common configuration errors and known issues.
GNU General Public License v2.0
174 stars 51 forks source link

Uncaught TypeError: Unsupported operand types: string - int #442

Closed Zodiac1978 closed 1 year ago

Zodiac1978 commented 1 year ago

Feature request/bug description

A client has updated to PHP 8.1 and although the website is running fine there is one fatal error with site health:

Fatal error: Uncaught TypeError: Unsupported operand types: string - int in /wp-admin/includes/class-wp-site-health.php:2794 Stack trace: 
#0 /wp-admin/includes/class-wp-site-health.php(1763): WP_Site_Health->has_missed_cron() 
#1 /wp-admin/includes/class-wp-site-health.php(194): WP_Site_Health->get_test_scheduled_events() 
#2 /wp-admin/includes/class-wp-site-health.php(139): WP_Site_Health->perform_test(Array) 
#3 /wp-includes/class-wp-hook.php(308): WP_Site_Health->enqueue_scripts('site-health.php') 
#4 /wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters(NULL, Array) 
#5 /wp-includes/plugin.php(517): WP_Hook->do_action(Array) 
#6 /wp-admin/admin-header.php(118): do_action('admin_enqueue_s...', 'site-health.php') 
#7 /wp-admin/site-health.php(96): require_once('/homepages/8/d3...') 
#8 {main} thrown in /wp-admin/includes/class-wp-site-health.php on line 2794

Has anybody seen this before and has an idea why this happens?

brainmangv commented 1 year ago

any solution for that ?

Clorith commented 1 year ago

This is an error in a WordPress core file, I would recommend opening a bug ticket at https://core.trac.wordpress.org if it is still a recurring issue.

https://core.trac.wordpress.org/ticket/58221 seems like it may be similar, although not the same line, I suspect the root issue is connected, and that this is bad data in the DB causing the type-strictness of PHP 8.x to kick in.

I'm going to close the ticket here on GitHub, since this should be addressed in core if it is still a problem though :)