I had a complain of critical error on one of the wordpress website. When I checked teh debug log I found mutiple warnings but This was the consistent error which was reoccuring. The error doesnt stay for too long, a couple of refresh fixes it, but it seems like something is happneing in the themes filter.php file. I have added the stacktrace changed the name of theme file and redacted the IP address.
Stack Trace
2021-07-06 [NOTICE] [XXX.XXX.XXX.XXX:48998#wordpress] [STDERR] PHP Fatal error: Uncaught TypeError: Argument 1 passed to App\{closure}() must be of the type array, nu$Stack trace:
#0 /var/www/html/wp-includes/class-wp-hook.php(294): App\{closure}(NULL)
#1 /var/www/html/wp-includes/plugin.php(212): WP_Hook->apply_filters(NULL, Array)
#2 /var/www/html/wp-includes/post-template.php(836): apply_filters('body_class', Array, Array)
#3 /var/www/html/wp-content/themes/mytheme/vendor/roots/sage-woocommerce/src/woocommerce.php(41): get_body_class()
#4 /var/www/html/wp-includes/class-wp-hook.php(292): App\{closure}('emails/admin-ne...', '', '/var/www/html/w...', Array)
#5 /var/www/html/wp-includes/class-wp-hook.php(316): WP_Hook->apply_filters('', Array)
#6 /var/www/html/wp-includes/plugin.php(484): WP_Hook->do_action(Array)
#7 /var/www/html/wp-content/plugins/woocommerce/includes/wc-core-functions.php(343): do_action('woocommerce_bef...', 'emails/a in /var/www/html/wp-content/themes/mytheme/app/filters$
Could this be triggered because of some other code ?
It seems that the error originates from the sage-woocommerce composer library dependency (not a WordPress plugin btw.!) of the sage theme.
The latest release of this library at time of writing is 1.0.4 (see https://github.com/roots/sage-woocommerce/releases).
Have you updated the version of it in your theme to this latest release yet?
This may fix the issue and incompatibility issues that arise when WordPress core or WooCommerce plugin are updated.
This is what my composer.json looks like, and I also tried composer update roots/sage-woocommerce and nothing got updated so I can say that I am on the latest verison of sage-woocommerce.