Fatal errors with PHP 8 + HyperDB
-
Hello,
The Events Calendar triggers a fatal error when using HyperDB (https://github.com/Automattic/HyperDB) and PHP 8:
Fatal error: Uncaught Error: mysqli_result object is already closed in /var/www/wp-content/db.php on line 1437 Call stack: mysqli_num_fields() wp-content/db.php:1437 hyperdb::ex_mysql_num_fields() wp-content/db.php:973 hyperdb::query() wp-includes/wp-db.php:2722 wpdb::get_var() wp-includes/class-wp-query.php:3381 WP_Query::set_found_posts() wp-includes/class-wp-query.php:3065 WP_Query::get_posts() wp-content/plugins/the-events-calendar/common/src/Tribe/Repository.php:656 Tribe__Repository::found() wp-content/plugins/the-events-calendar/src/Tribe/Views/V2/View.php:2433 Tribe\E\V\V\View::upcoming_events_count() wp-content/plugins/the-events-calendar/src/Tribe/Views/V2/View.php:1907 Tribe\E\V\V\View::setup_messages() wp-content/plugins/the-events-calendar/src/Tribe/Views/V2/View.php:1491 Tribe\E\V\V\View::setup_template_vars() wp-content/plugins/the-events-calendar/src/Tribe/Views/V2/Views/List_View.php:265 Tribe\E\V\V\V\List_View::setup_template_vars() wp-content/plugins/the-events-calendar/src/Tribe/Views/V2/View.php:646 Tribe\E\V\V\View::get_html() wp-content/plugins/the-events-calendar/src/Tribe/Views/V2/Template_Bootstrap.php:262 Tribe\E\V\V\Template_Bootstrap::get_view_html() wp-content/plugins/the-events-calendar/src/views/v2/default-template.php:19 include() wp-includes/template-loader.php:106 require_once() wp-blog-header.php:19 require() index.php:17
Here are the steps to reproduce the issue:
- Install WordPress v6.0.1
- Install HyperDB v1.8, using the default config (just copy
db.php
anddb-config.php
as-is right from the repo) - Ensure the site is on PHP 7 (if you try to install the plugin on PHP 8 with HyperDB, it fatals and doesn’t install)
- Install and activate The Events Calendar v6.0.0.1
- Switch the test site to PHP 8
- Add and publish a test event: WP Admin → Events → Add New
- Visit the Events archive page (WP Admin → Events (in admin bar) → View Calendar, or by appending ?post_type=tribe_events to your test site URL)
- Observe the fatal error triggered
The issue appears to be with how the plugin is filtering
posts_pre_query
, as when I comment out the following line the fatals go away:
- The topic ‘Fatal errors with PHP 8 + HyperDB’ is closed to new replies.