0

Recently updated to PHP8.2 and I'm getting a critical error related to the theme.

The critical error is:

Fatal error: Uncaught ArgumentCountError: Too few arguments to function WP_Widget::__construct(), 0 passed in /home/klm/ftp/hpt/wp-includes/class-wp-widget-factory.php on line 62 and at least 2 expected in /home/klm/ftp/hpt/wp-includes/class-wp-widget.php:163 Stack trace: #0 /home/klm/ftp/hpt/wp-includes/class-wp-widget-factory.php(62): WP_Widget->__construct() #1 /home/klm/ftp/hpt/wp-includes/widgets.php(115): WP_Widget_Factory->register('qns_booking_wid...') #2 /home/klm/ftp/hpt/wp-content/themes/nice_hotel/functions/widgets/widget-booking.php(138): register_widget('qns_booking_wid...') #3 /home/klm/ftp/hpt/wp-includes/class-wp-hook.php(324): qns_booking_widget('') #4 /home/klm/ftp/hpt/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array) #5 /home/klm/ftp/hpt/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #6 /home/klm/ftp/hpt/wp-includes/widgets.php(1858): do_action('widgets_init') #7 /home/klm/ftp/hpt/wp-includes/class-wp-hook.php(324): wp_widgets_init('') #8 /home/klm/ftp/hpt/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array) #9 /home/klm/ftp/hpt/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #10 /home/klm/ftp/hpt/wp-settings.php(643): do_action('init') #11 /home/klm/ftp/hpt/wp-config.php(103): require_once('/home/klm/ftp/h...') #12 /home/klm/ftp/hpt/wp-load.php(50): require_once('/home/klm/ftp/h...') #13 /home/klm/ftp/hpt/wp-admin/admin.php(34): require_once('/home/klm/ftp/h...') #14 /home/klm/ftp/hpt/wp-admin/index.php(10): require_once('/home/klm/ftp/h...') #15 {main} thrown in /home/klm/ftp/hpt/wp-includes/class-wp-widget.php on line 163

Please help to fix this problem

1
  • 1
    this is usually caused by a widget that wasn't built correctly, the stack trace points the finger at themes/nice_hotel/functions/widgets/widget-booking.php and a widget that begins with qns_booking_wid, is this code you wrote yourself? Or is nice_hotel a theme you bought/downloaded? Commented Dec 7, 2023 at 15:12

1 Answer 1

2

Seems like the theme you use (nice_hotel?) uses an extremely outdated version of registering a widget (see here). As this seems to be a premium theme, you should probably contact the themes author, but as i couldn't find an "active" version of this theme (if it is nice_hotel: themeforest theme shows "no longer available"), you're probably going to get into more trouble along the way. You should probably switch the theme or pay a developer to make the theme PHP8- / Wordpress6-Compatible.

Happy Coding!

2
  • 2
    There's a contact form for the author on themeforest you could try too. Commented Dec 7, 2023 at 15:50
  • @Rup if you've identified it's a question asking about a 3rd party product you should vote to close the question as offtopic Commented Dec 7, 2023 at 16:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.