• Resolved Raam Dev

    (@raamdev)


    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:

    1. Install WordPress v6.0.1
    2. Install 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.www.ads-software.com/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.