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

Playground is creating a fatal error in site health #121

Closed
Zodiac1978 opened this issue Jun 13, 2024 · 3 comments
Closed

Playground is creating a fatal error in site health #121

Zodiac1978 opened this issue Jun 13, 2024 · 3 comments

Comments

@Zodiac1978
Copy link

Steps to reproduce:

  1. Go to https://playground.wordpress.net/
  2. Go to Tools -> Site Health (/wp-admin/site-health.php)
  3. See the fatal error.

Here are the logs:

[13-Jun-2024 14:43:05 UTC] PHP Fatal error:  Uncaught Error: Call to undefined function mysqli_get_client_info() in /wordpress/wp-admin/includes/class-wp-site-health.php:3
Stack trace:
#0 /wordpress/wp-admin/includes/class-wp-site-health.php(3): WP_Site_Health->get_test_utf8mb4_support()
#1 /wordpress/wp-admin/includes/class-wp-site-health.php(3): WP_Site_Health->perform_test(Array)
#2 /wordpress/wp-includes/class-wp-hook.php(3): WP_Site_Health->enqueue_scripts('site-health.php')
#3 /wordpress/wp-includes/class-wp-hook.php(3): WP_Hook->apply_filters(NULL, Array)
#4 /wordpress/wp-includes/plugin.php(2): WP_Hook->do_action(Array)
#5 /wordpress/wp-admin/admin-header.php(17): do_action('admin_enqueue_s...', 'site-health.php')
#6 /wordpress/wp-admin/site-health.php(2): require_once('/wordpress/wp-a...')
#7 {main}
  thrown in /wordpress/wp-admin/includes/class-wp-site-health.php on line 3
[13-Jun-2024 14:43:05 UTC] PHP Fatal: PHP.run() failed with exit code 255 and the following output:  PHPExecutionFailureError@https://playground.wordpress.net/worker-thread-492c00ae.js?wpVersion=6.5&phpVersion=8.0&php-extension=iconv&php-extension=mbstring&php-extension=xml-bundle&php-extension=gd&networking=no&storage=none&site-slug=wordpress:38:432
run@https://playground.wordpress.net/worker-thread-492c00ae.js?wpVersion=6.5&phpVersion=8.0&php-extension=iconv&php-extension=mbstring&php-extension=xml-bundle&php-extension=gd&networking=no&storage=none&site-slug=wordpress:53:1748
[13-Jun-2024 14:42:49 UTC] PHP Fatal error:  Uncaught Error: Call to undefined function mysqli_get_client_info() in /wordpress/wp-admin/includes/class-wp-site-health.php:3
Stack trace:
#0 /wordpress/wp-admin/includes/class-wp-site-health.php(3): WP_Site_Health->get_test_utf8mb4_support()
#1 /wordpress/wp-admin/includes/class-wp-site-health.php(3): WP_Site_Health->perform_test(Array)
#2 /wordpress/wp-includes/class-wp-hook.php(3): WP_Site_Health->enqueue_scripts('site-health.php')
#3 /wordpress/wp-includes/class-wp-hook.php(3): WP_Hook->apply_filters(NULL, Array)
#4 /wordpress/wp-includes/plugin.php(2): WP_Hook->do_action(Array)
#5 /wordpress/wp-admin/admin-header.php(17): do_action('admin_enqueue_s...', 'site-health.php')
#6 /wordpress/wp-admin/site-health.php(2): require_once('/wordpress/wp-a...')
#7 {main}
  thrown in /wordpress/wp-admin/includes/class-wp-site-health.php on line 3
[13-Jun-2024 14:42:49 UTC] PHP Fatal: PHP.run() failed with exit code 255 and the following output:  PHPExecutionFailureError@https://playground.wordpress.net/worker-thread-492c00ae.js?wpVersion=6.5&phpVersion=8.0&php-extension=iconv&php-extension=mbstring&php-extension=xml-bundle&php-extension=gd&networking=no&storage=none&site-slug=wordpress:38:432
run@https://playground.wordpress.net/worker-thread-492c00ae.js?wpVersion=6.5&phpVersion=8.0&php-extension=iconv&php-extension=mbstring&php-extension=xml-bundle&php-extension=gd&networking=no&storage=none&site-slug=wordpress:53:1748

Not sure what is causing this ... but maybe it has to do with $wpdb->get_var( 'SELECT VERSION()' ); not working on SQLite.
https://github.com/WordPress/WordPress/blob/master/wp-admin/includes/class-wp-site-health.php#L212

We could polyfill this with a user defined function.
More ideas here: https://stackoverflow.com/questions/9646353/how-to-find-database-file-version

@Zodiac1978
Copy link
Author

The function call to mysqli_get_client_info was used (until WordPress 6.5) in the method get_test_utf8mb4_support of the WP_Site_Health class. But in this class this method was removed for WordPress 6.6.
https://github.com/WordPress/WordPress/blob/master/wp-admin/includes/class-wp-site-health.php

Because WordPress 6.6 is not released yet, it is still shown in the documentation (just search for get_test_utf8mb4_support and you will find it):
https://developer.wordpress.org/reference/classes/wp_site_health/#source

This function was removed with this commit:
WordPress/WordPress@78d7296

Ticket: https://core.trac.wordpress.org/ticket/60096 (Milestone 6.6)
Changeset: https://core.trac.wordpress.org/changeset/57926

This explains why there is a fatal error. As mysqli_get_client_info does not work with a SQLite database.

Unsure how to proceed here. This function is already removed, so this fatal error will disappear with WordPress 6.6.

I don't know if this is something you want to backport. If yes, this would need a safeguard, to check if there is a MySQL/MariaDB or a SQLite database.

@Zodiac1978
Copy link
Author

To prove my findings. Playground with WordPress 6.6 (beta 3 at the moment) is not having this error anymore:
https://playground.wordpress.net/?php=8.0&wp=beta&storage=none

@aristath
Copy link
Member

Now that WP 6.6 has been released, I believe we can close this one 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants