woocommerce/woocommerce-admin

Latest commit of Update store setup widget to use task list API #31755 generates fatal error

wplaunchify opened this issue · 4 comments

Prerequisites

  • I have carried out troubleshooting steps and I believe I have found a bug.
  • I have searched for similar bugs in both open and closed issues and cannot find a duplicate.

Describe the bug

This update throws a critical error in my multisite setup. See below:
When I go back to previous commit the error is resolved.

Fatal error: Uncaught Error: Call to a member function is_complete() on null in /home/387089.cloudwaysapps.com/jwmkkrtvnr/public_html/wp-content/plugins/woocommerce/includes/admin/class-wc-admin-dashboard-setup.php:173 Stack trace: #0 /home/387089.cloudwaysapps.com/jwmkkrtvnr/public_html/wp-content/plugins/woocommerce/includes/admin/class-wc-admin-dashboard-setup.php(44): WC_Admin_Dashboard_Setup->should_display_widget() woocommerce/woocommerce#1 /home/387089.cloudwaysapps.com/jwmkkrtvnr/public_html/wp-content/plugins/woocommerce/includes/admin/class-wc-admin-dashboard-setup.php(181): WC_Admin_Dashboard_Setup->__construct() woocommerce/woocommerce#2 /home/387089.cloudwaysapps.com/jwmkkrtvnr/public_html/wp-content/plugins/woocommerce/includes/admin/class-wc-admin.php(102): include('/home/387089.cl...') woocommerce/woocommerce#3 /home/387089.cloudwaysapps.com/jwmkkrtvnr/public_html/wp-includes/class-wp-hook.php(307): WC_Admin->conditional_includes() woocommerce/woocommerce#4 /home/387089.cloudwaysapps.com/jwmkkrtvnr/public_html/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters() woocommerce/woocommerce#5 /home/387089.cloudwaysa in /home/387089.cloudwaysapps.com/jwmkkrtvnr/public_html/wp-content/plugins/woocommerce/includes/admin/class-wc-admin-dashboard-setup.php on line 173
There has been a critical error on this website.

Expected behavior

It shouldn't crash the site with a fatal error

Actual behavior

it shows the error above

Steps to reproduce

update to latest version where this commit was pushed.... line 173 throws the fatal error
woocommerce/woocommerce#31755 (comment)

WordPress Environment

Latest WP 5.9 with latest version of WooCommerce (from the commit)... I didn't pull the status report, because it happened on several of my sites and I was able to fix the issue by reverting the commit listed above to the prior version.

Isolating the problem

  • I have deactivated other plugins and confirmed this bug occurs when only WooCommerce plugin is active.
  • This bug happens with a default WordPress theme active, or Storefront.
  • I can reproduce this bug consistently using the steps above.

Hi @wplaunchify,

Thank you for reporting this issue. However, I cannot reproduce it on my end using WooCommerce 6.2.0 (the latest WC version that contains PR #31755), both on a single site and multisite installation of WP 5.9. I was able to load the WP Admin Dashboard just fine without getting any fatal errors. The dashboard also looks fine when I tried to view it as a user with a non-admin role, like an Author or Contributor.

Here are the steps I took when I tried to recreate your issue:

  1. I set up a WP 5.9 multisite installation.
  2. I installed WooCommerce 6.1.1.
  3. I left the Onboarding Wizard incomplete. I only completed the store details portion (Step 1 of the onboarding flow).
  4. I created a non-admin user. I set its role to 'Author'.
  5. Before proceeding to the next steps, I made sure to enable the 'Task List' in the WC Home page.
  6. I upgraded WooCommerce to 6.2.0. I didn't encounter any fatal errors after upgrading to 6.2.0.
  7. On a different browser session, I logged in to the WP Admin Dashboard using the 'Author' user I created in the earlier step.
  8. I was able to login to the Dashboard just fine as an Author.
  9. I tried with a different user role and I'm still able to login to the Dashboard just fine without getting any fatal errors.

Could it be that some functionalities from your other plugins are causing the fatal error? Or is there any specific set up we need to do in order to reproduce the issue from our end?

If possible, please test your site for theme and plugins conflict. To do that, you’d need to deactivate all plugins except for WooCommerce and switch the default theme such as Storefront. Then test again.

If the issue is resolved with the default theme and all plugins deactivated, it means that one of your plugins or a theme is causing the issue. You will then need to enable it one by one and test every time you do that in order to figure out which plugin is causing it.

Thanks!

Update: It seems that this can be reproduced when onboarding is removed from the woocommerce_admin_features filter. We're now able to reproduce it using this snippet:

add_filter( 'woocommerce_admin_features', function( $features ) {
	array_splice( $features, array_search('onboarding', $features ), 1);
	return $features;
} );

I'm transferring this issue to the woocommerce/woocommerce-admin repo.

Link to internal discussion: p1644481991624209-slack-C01DT6U03HC

4764004-zen