• Hello,

    I am seeing this error when using this plugin on a site with W3 Cache. I understand you cannot test against all plugins and some interactions may occur. I’m just sharing this so you’re aware and maybe see a potential fix.

    I am using W3 Cache with the Database Cache. It seems like this is impacting your plugin or vice versa.

    I’m using Version 1.6.1.

    [06-May-2026 11:49:18 UTC] PHP Fatal error:  Uncaught TypeError: mysqli_num_fields(): Argument #1 ($result) must be of type mysqli_result, true given in /var/www/html/example-com-live/wp-includes/class-wpdb.php:3876
    Stack trace:
    #0 /var/www/html/example-com-live/wp-includes/class-wpdb.php(3876): mysqli_num_fields()
    #1 /var/www/html/example-com-live/wp-includes/class-wpdb.php(785): wpdb->load_col_info()
    #2 /var/www/html/example-com-live/wp-content/plugins/w3-total-cache/DbCache_WpdbInjection_QueryCaching.php(230): wpdb->__get()
    #3 /var/www/html/example-com-live/wp-content/plugins/w3-total-cache/DbCache_WpdbNew.php(216): W3TC\DbCache_WpdbInjection_QueryCaching->query()
    #4 /var/www/html/example-com-live/wp-content/plugins/aaa-option-optimizer/src/class-database.php(199): W3TC\DbCache_WpdbNew->query()
    #5 /var/www/html/example-com-live/wp-content/plugins/aaa-option-optimizer/src/class-plugin.php(182): Progress_Planner\OptionOptimizer\Database::batch_insert()
    #6 /var/www/html/example-com-live/wp-includes/class-wp-hook.php(341): Progress_Planner\OptionOptimizer\Plugin->update_tracked_options()
    #7 /var/www/html/example-com-live/wp-includes/class-wp-hook.php(365): WP_Hook->apply_filters()
    #8 /var/www/html/example-com-live/wp-includes/plugin.php(522): WP_Hook->do_action()
    #9 /var/www/html/example-com-live/wp-includes/load.php(1308): do_action()
    #10 [internal function]: shutdown_action_hook()
    #11 {main}
    thrown in /var/www/html/example-com-live/wp-includes/class-wpdb.php on line 3876
Viewing 1 replies (of 1 total)
  • Plugin Author Filip Ilić

    (@filipi)

    Hi @1seth ,

    thanks for the detailed report!

    Our plugin starts a database transaction with the keyword BEGIN, and W3TC’s database cache normally skips queries like this… but it has a tiny gap in how it detects them: it recognizes the equivalent keyword START TRANSACTION but not BEGIN. So our BEGIN slipped through, W3TC tried to cache it as if it were a regular query, and that’s where things blew up. I reproduced it locally with W3TC 2.9.4 to confirm.

    Fix: A single-line change in src/class-database.php – replace BEGIN with START TRANSACTION (semantically identical in MySQL). It will be in the next release.

    If you’d like to patch it yourself in the meantime, edit wp-content/plugins/aaa-option-optimizer/src/class-database.php, find this line (around line 199):

    $wpdb->query( 'BEGIN' );

    and change it to:

    $wpdb->query( 'START TRANSACTION' );

    Thanks again for the heads-up!

Viewing 1 replies (of 1 total)

You must be logged in to reply to this topic.