PHP Fatal error: Uncaught Error: Call to a member function get_result() on null

[ad_1]

Hi!

We are migrating our site from PHP 7 to PHP 8.

Contact Form 7 is working well in PHP 7, but not in PHP 8.

The working site is:

The new site is working under this IP: 18.198.155.123
So to test, you need to add this lines to your hosts file.
18.198.155.123
18.198.155.123 tabiquepluvial.es

After submitting the form, you will get the typical WordPress error page.
and in logs:
[14-Sep-2022 05:35:07 UTC] PHP Fatal error: Uncaught Error: Call to a member function get_result() on null in /DOCUMENT_ROOT/wp-content/plugins/contact-form-7/includes/contact-form.php:1054
Stack trace:
#0 /DOCUMENT_ROOT/wp-content/plugins/contact-form-7/includes/controller.php(25): WPCF7_ContactForm->submit()
#1 /var/www/tabiquepluvial/wp-includes/class-wp-hook.php(305): wpcf7_control_init()
#2 /var/www/tabiquepluvial/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters()
#3 /var/www/tabiquepluvial/wp-includes/plugin.php(524): WP_Hook->do_action()
#4 /var/www/tabiquepluvial/wp-includes/class-wp.php(398): do_action_ref_array()
#5 /var/www/tabiquepluvial/wp-includes/class-wp.php(770): WP->parse_request()
#6 /var/www/tabiquepluvial/wp-includes/functions.php(1330): WP->main()
#7 /var/www/tabiquepluvial/wp-blog-header.php(16): wp()
#8 /var/www/tabiquepluvial/index.php(17): require(‘…’)
#9 {main}
thrown in /DOCUMENT_ROOT/wp-content/plugins/contact-form-7/includes/contact-form.php on line 1054

Details old site:
Contact Form 7 version: 5.6.3
PHP 7.2.34
Details new site:
Contact Form 7 version: 5.6.3
PHP 8.1

Any idea?

Regards,
Jordi
JOINSO

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer