• Hi Aaron,

    please find another fatal error running PHP8.1 + WordPress 6.0.2. W3 total cache is active, but the error is triggered in function updatePermalinkCache. When accessing a non-existing website the WordPress technical error page is thrown. I have deactivated the plugin, removed all 404 database tables and reenabled it, which apparently fixed the problem. Would be good to see if the invalid mysql return could be handled in the code.

    PHP Fatal error:  Uncaught TypeError: mysqli_num_fields(): Argument #1 ($result) must be of type mysqli_result, bool given in /usr/share/wordpress/wp-includes/wp-db.php:3547
    Stack trace:
    #0 /usr/share/wordpress/wp-includes/wp-db.php(3547): mysqli_num_fields()
    #1 /usr/share/wordpress/wp-includes/wp-db.php(737): wpdb->load_col_info()
    #2 /var/lib/wordpress/wp-content/plugins/w3-total-cache/DbCache_WpdbInjection_QueryCaching.php(218): wpdb->__get()
    #3 /var/lib/wordpress/wp-content/plugins/w3-total-cache/DbCache_WpdbNew.php(122): W3TC\DbCache_WpdbInjection_QueryCaching->query()
    #4 /usr/share/wordpress/wp-includes/wp-db.php(2836): W3TC\DbCache_WpdbNew->query()
    #5 /var/lib/wordpress/wp-content/plugins/404-solution/includes/DataAccess.php(186): wpdb->get_results()
    #6 /var/lib/wordpress/wp-content/plugins/404-solution/includes/DataAccess.php(1980): ABJ_404_Solution_DataAccess->queryAndGetResults()
    #7 /var/lib/wordpress/wp-content/plugins/404-solution/includes/PermalinkCache.php(67): ABJ_404_Solution_DataAccess->updatePermalinkCache()
    #8 /var/lib/wordpress/wp-content/plugins/404-solution/includes/SpellChecker.php(635): ABJ_404_Solution_PermalinkCache->updatePermalinkCache()
    #9 /var/lib/wordpress/wp-content/plugins/404-solution/includes/SpellChecker.php(396): ABJ_404_Solution_SpellChecker->initializePublishedPostsProvider()
    #10 /var/lib/wordpress/wp-content/plugins/404-solution/includes/SpellChecker.php(310): ABJ_404_Solution_SpellChecker->findMatchingPosts()
    #11 /var/lib/wordpress/wp-content/plugins/404-solution/includes/WordPress_Connector.php(263): ABJ_404_Solution_SpellChecker->getPermalinkUsingSpelling()
    #12 /var/lib/wordpress/wp-content/plugins/404-solution/404-solution.php(138): ABJ_404_Solution_WordPress_Connector->process404()
    #13 /usr/share/wordpress/wp-includes/class-wp-hook.php(307): abj404_404listener()
    #14 /usr/share/wordpress/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters()
    #15 /usr/share/wordpress/wp-includes/plugin.php(476): WP_Hook->do_action()
    #16 /usr/share/wordpress/wp-includes/template-loader.php(13): do_action()
    #17 /usr/share/wordpress/wp-blog-header.php(19): require_once('...')
    #18 /usr/share/wordpress/index.php(17): require('...')
    #19 {main}

    Thanks in advance for your support!

    Matthieu

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Aaron

    (@aaron13100)

    The mysqli_num_fields isn’t called in the 404 Solution code. Based on the stacktrace it looks like w3-total-cache is the issue. If I wrap that call in a try/catch, what do you suggest we do in the catch besides rethrowing the error?

    Thread Starter Matthieu-P. Schapranow

    (@theschappy)

    Hi Aaron,

    Thanks for the prompt reply. I expect the underlying problem is connected to function updatePermalinkCache() in DataAccess.php:1978, where a SQL script is read in from the file updatePermalinkCache.sql.

    Let us assume that the SQL statement triggers issues due to whatever reason, it will be used to call in DataAccess.php:186 the function queryAndGetResults and the underlying $wpdb->get_results. One option would be to add an try catch block here, but you are right, this is not what would be the expected behavior.

    Would be great if someone from W3 Total Cache support team could have a look at this.

    Thanks!

    Matthieu

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘mysqli_num_fields(): Argument #1 ($result) must be of type mysqli_result’ is closed to new replies.