Title: Fatal errors with PHP 8 + HyperDB
Last modified: September 16, 2022

---

# Fatal errors with PHP 8 + HyperDB

 *  Resolved [Raam Dev](https://wordpress.org/support/users/raamdev/)
 * (@raamdev)
 * [3 years, 8 months ago](https://wordpress.org/support/topic/fatal-errors-with-php-8-hyperdb/)
 * Hello,
 * The Events Calendar triggers a fatal error when using HyperDB ([https://github.com/Automattic/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:
    1. Install WordPress v6.0.1
    2. Install [HyperDB](https://wordpress.org/plugins/hyperdb/) v1.8, using the default
       config (just copy `db.php` and `db-config.php` as-is right from the repo)
    3. 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)
    4. Install and activate The Events Calendar v6.0.0.1
    5. Switch the test site to PHP 8
    6. Add and publish a test event: WP Admin → Events → Add New
    7. 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)
    8. 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:
 * [https://plugins.trac.wordpress.org/browser/the-events-calendar/tags/6.0.0.1/src/Events/Custom_Tables/V1/WP_Query/Modifiers/Events_Only_Modifier.php#L47](https://plugins.trac.wordpress.org/browser/the-events-calendar/tags/6.0.0.1/src/Events/Custom_Tables/V1/WP_Query/Modifiers/Events_Only_Modifier.php#L47)

The topic ‘Fatal errors with PHP 8 + HyperDB’ is closed to new replies.

 * ![](https://ps.w.org/the-events-calendar/assets/icon-256x256.gif?rev=2516440)
 * [The Events Calendar](https://wordpress.org/plugins/the-events-calendar/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/the-events-calendar/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/the-events-calendar/)
 * [Active Topics](https://wordpress.org/support/plugin/the-events-calendar/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/the-events-calendar/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/the-events-calendar/reviews/)

 * 16 replies
 * 7 participants
 * Last reply from: [WilloftheD](https://wordpress.org/support/users/abzlevelup/)
 * Last activity: [3 years, 6 months ago](https://wordpress.org/support/topic/fatal-errors-with-php-8-hyperdb/page/2/#post-16250143)
 * Status: resolved