Critical Error
Closed this issue · 1 comments
Hi
I have started to experience critical errors with User Switching activated. I also have Woocommerce, Woo Product Vendor and Woo Bookings installed. When I create a booking and click book now (effectively adding to basket) the critical errors happens. If I deactivate User Switching it works ok. I have a dump of the log below. any ideas please?
cheers
Tim
Using User Switching 1.5.4
Woocommerce 3.9.2
Woo Bookings 1.15.15
Woo Product Vendor 2.1.28
[02-Apr-2020 09:43:46 UTC] PHP Warning: Invalid argument supplied for foreach() in /home/c11pluss/public_html/wp-content/plugins/woocommerce-memberships/includes/class-wc-memberships-capabilities.php on line 71
[02-Apr-2020 09:43:46 UTC] PHP Fatal error: Uncaught TypeError: Argument 2 passed to user_switching::filter_user_has_cap() must be of the type array, string given, called in /home/c11pluss/public_html/wp-includes/class-wp-hook.php on line 288 and defined in /home/c11pluss/public_html/wp-content/plugins/user-switching/user-switching.php:867
Stack trace:
#0 /home/c11pluss/public_html/wp-includes/class-wp-hook.php(288): user_switching->filter_user_has_cap(Array, 'edit_other_vend...', Array, Object(WP_User))
#1 /home/c11pluss/public_html/wp-includes/plugin.php(206): WP_Hook->apply_filters(Array, Array)
#2 /home/c11pluss/public_html/wp-includes/class-wp-user.php(780): apply_filters('user_has_cap', Array, 'edit_other_vend...', Array, Object(WP_User))
#3 /home/c11pluss/public_html/wp-includes/capabilities.php(658): WP_User->has_cap('edit_post', 27230)
#4 /home/c11pluss/public_html/wp-content/themes/focusblog/inc/extra/meta-options.php(32): current_user_can('edit_post', 27230)
#5 /home/c11pluss/public_html/wp-includes/class-wp-hook.php(290): thrive_save_post_f in /home/c11pluss/public_html/wp-content/plugins/user-switching/user-switching.php on line 867
This means that one of your other plugins or your theme is passing a parameter of an incorrect type to one of the capability checks. This is a hidden error that is probably causing a hidden bug on your site, and User Switching happens to be the plugin that surfaces it.
The first line in your report shows that this bug is also triggering an error in woocommerce-memberships, albeit a less severe one. If you deactivate User Switching you'll see that woocommerce-memberships warning still appearing in your error log.
It appears the error is coming from themes/focusblog/inc/extra/meta-options.php(32) but I'm not 100% sure. I would try switching to one of the default themes to verify if the theme is the cause, and if it is then get in contact with the author of your theme.