Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Describe the problem (reference the issue if applicable) and what the PR accomplishes.
Steps to Reproduce
Receiving this error in a WPEngine hosting environment. We do not know what triggered it but we did see that sometimes $this->nexus can be null in this function in certain instances. Added a simply null check:
Error Details
An error of type E_ERROR was caused in line 24 of the file /nas/content/live/oursite/wp-content/plugins/taxjar-simplified-taxes-for-woocommerce/includes/class-wc-taxjar-nexus.php. Error message: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in /nas/content/live/oursite/wp-content/plugins/taxjar-simplified-taxes-for-woocommerce/includes/class-wc-taxjar-nexus.php:24 Stack trace:
#0 /nas/content/live/oursite/wp-content/plugins/taxjar-simplified-taxes-for-woocommerce/includes/class-taxjar-settings.php(330): WC_Taxjar_Nexus->get_form_settings_field() #1 /nas/content/live/oursite/wp-content/plugins/taxjar-simplified-taxes-for-woocommerce/includes/class-taxjar-settings.php(208): TaxJar_Settings::get_nexus_settings_display() #2 /nas/content/live/oursite/wp-content/plugins/taxjar-simplified-taxes-for-woocommerce/includes/class-taxjar-settings.php(645): TaxJar_Settings::get_settings() #3 /nas/content/live/oursite/wp-includes/class-wp-hook.php(310): TaxJar_Settings::save('') #4 /nas/content/live/oursite/wp-includes/class-wp-hook.php(334): WP_Hook->apply_filters('', Array) #5 /nas/content/live/oursite/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #6 /nas/content/live/oursite/wp-content/plugins/woocommerce/includes/admin/class-wc-admin-settings.php(77): do_action('woocommerce_set...') #7 /nas/content/live/oursite/wp-content/plugins/woocommerce/includes/admin/class-wc-admin-menus.php(153): WC_Admin_Settings::save() #8 /nas/content/live/oursite/wp-includes/class-wp-hook.php(310): WC_Admin_Menus->save_settings('') #9 /nas/content/live/oursite/wp-includes/class-wp-hook.php(334): WP_Hook->apply_filters(NULL, Array) #10 /nas/content/live/oursite/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #11 /nas/content/live/oursite/wp-settings.php(654): do_action('wp_loaded') #12 /nas/content/live/oursite/wp-config.php(121): require_once('/nas/content/li...') #13 /nas/content/live/oursite/wp-load.php(50): require_once('/nas/content/li...') #14 /nas/content/live/oursite/wp-admin/admin.php(34): require_once('/nas/content/li...') #15 {main}
thrown
Expected Result
No error should be thrown when $this->nexus is null and the admin page with settings is visited.
Click-Test Versions
Specs Passing