Hello Willy,
The add_settings_section is a WordPress Core function. How did you create this bug? Which steps I should repeat to have it? Also, I need the full call stack.
Many thanks,
I upgraded, then I accessed admin.
I know it’s a core function, but it’s not always loaded (require wp-admin/includes/template.php ). Maybe it’s called too early ?
The plugin is extensively tested and covered by automatic tests.
The culprit is another plugin or theme which calls set_current_screen, where do_action( ‘current_screen’,… is executed, which triggers our code. I met similar case in years ago. Those time it was Jetpack.
I want to confirm this guess and see the full call stack. Could you share it with me?
I’m receiving the exact same error message when updating from version 4.0.1 to 4.1.0: An error of type E_ERROR was caused in line 613 of the file.
WordPress version 6.5.2
Active theme: GeneratePress Child for Bitcoin Outlaw (version 0.1)
Current plugin: hCaptcha for WordPress (version 4.1.0)
PHP version 7.4.33
Error Details
=============
An error of type E_ERROR was caused in line 613 of the file /home/customer/www/bitcoinoutlaw.com/public_html/wp-content/plugins/hcaptcha-for-forms-and-more/src/php/Settings/Abstracts/SettingsBase.php. Error message: Uncaught Error: Call to undefined function KAGG\Settings\Abstracts\add_settings_section() in /home/customer/www/bitcoinoutlaw.com/public_html/wp-content/plugins/hcaptcha-for-forms-and-more/src/php/Settings/Abstracts/SettingsBase.php:613
Stack trace:
#0 /home/customer/www/bitcoinoutlaw.com/public_html/wp-includes/class-wp-hook.php(324): KAGG\Settings\Abstracts\SettingsBase->setup_tabs_section(Object(WP_Screen))
#1 /home/customer/www/bitcoinoutlaw.com/public_html/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array)
#2 /home/customer/www/bitcoinoutlaw.com/public_html/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#3 /home/customer/www/bitcoinoutlaw.com/public_html/wp-admin/includes/class-wp-screen.php(424): do_action(‘current_screen’, Object(WP_Screen))
#4 /home/customer/www/bitcoinoutlaw.com/public_html/wp-admin/includes/screen.php(243): WP_Screen->set_current_screen()
#5 /home/customer/www/bitcoinoutlaw.com/public_html/wp-content/plugins/woocommerce-payments/vendor/automattic/jetpack
Thank you for providing the full call stack. Now I see that the culprit is the woocommerce-payments plugin, which calls set_current_screen too early.
I have already prepared a “blind fix”. Tomorrow I will test it with the erroneous plugin and release the hotfix.
P.S. Ha, and this plugin uses faulty automatic vendor Jetpack lib, which carries this bug through years (please see above).
@willybahuaud @reidwalley could you try the hotfix 4.1.1 and let me know? Thanks.
So far so good. I have plugins set to auto-update, so I’m running hCaptcha for WordPress v4.1.1. And I haven’t received an Fatal Error message from my site so far 🙂
Thank you, @reidwalley, for the confirmation.