taxjar / taxjar-woocommerce-plugin

WooCommerce Sales Tax Plugin by TaxJar
http://www.taxjar.com/woocommerce-sales-tax-plugin/
GNU General Public License v2.0
28 stars 29 forks source link

Fatal error during TaxJar configuration (Step 1) #256

Open DevMwd opened 2 months ago

DevMwd commented 2 months ago

During step 1, returning from logging in and connecting on "app.taxjar.com", the plugin causes a fatal error due to passing a string to the PHP count() function.

Here is the stack trace:

PHP Fatal error:  Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, string given in /.../wp-content/plugins/taxjar-simplified-taxes-for-woocommerce/includes/class-wc-taxjar-nexus.php:24
Stack trace:
#0 /.../wp-content/plugins/taxjar-simplified-taxes-for-woocommerce/includes/class-taxjar-settings.php(330): WC_Taxjar_Nexus->get_form_settings_field()
#1 /.../wp-content/plugins/taxjar-simplified-taxes-for-woocommerce/includes/class-taxjar-settings.php(208): TaxJar_Settings::get_nexus_settings_display()
#2 /.../wp-content/plugins/taxjar-simplified-taxes-for-woocommerce/includes/class-taxjar-settings.php(645): TaxJar_Settings::get_settings()
#3 /.../wp-includes/class-wp-hook.php(324): TaxJar_Settings::save()
#4 /.../wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()
#5 /.../wp-includes/plugin.php(517): WP_Hook->do_action()
#6 /.../wp-content/plugins/woocommerce/includes/admin/class-wc-admin-settings.php(80): do_action()
#7 /.../wp-content/plugins/woocommerce/includes/admin/class-wc-admin-menus.php(181): WC_Admin_Settings::save()
#8 /.../wp-includes/class-wp-hook.php(324): WC_Admin_Menus->save_settings()
#9 /.../wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()
#10 /.../wp-includes/plugin.php(517): WP_Hook->do_action()
#11 /.../wp-settings.php(717): do_action()
#12 /.../wp-config.php(106): require_once('...')
#13 /.../wp-load.php(50): require_once('...')
#14 /.../wp-admin/admin.php(34): require_once('...')

The PHP version on the server is 8.1.29 and the website is being served with FPM on an Apache server.

ahumulescu commented 1 month ago

Hi @DevMwd,

Thank you for raising this issue!

Coincidentally, I have the same setup for my local environment, but I have not managed to replicate your issue.

What versions of WooCommerce/WordPress are you using?

Also, would it be possible to check the actual string value that is passed to the count method, please? Is it just an empty string?

jccarlin commented 1 week ago

We came across the same error and figured out it resulted from our client's TaxJar account becoming inactive due to an old credit card tied to their payment. Once our client renewed their service, we continued to receive the error and the TaxJar settings page was also throwing an error that wouldn't allow us to reconnect the service.

We had tried deactivating and reactivating the plugin, but this didn't do the trick. Next we removed the stored hashed token from the DB, and this allowed us to reconnect the account through the TaxJar settings page in WP/WooCommerce.

Plugin and service has continued working as expected since then.