From the error message, we can see that strlen() receives an array instead of a string :
strlen() expects parameter 1 to be string, array is given in [...] WebformMailChimpHandler->postSave()
(line 320 of [...])
At Line 320 of this module, we have a call to mailchimp_subscribe() :
mailchimp_subscribe($configuration['list'], $email, array_filter($mergevars, 'strlen'), $configuration['interest_groups'], $double_optin);
The error is caused by what is passed in as the third argument : array_filter($mergevars, 'strlen'), meaning $mergevars - that is expected to be an array of strings to be filtered by strlen - contains an array instead of a string at some point.
How to fix $mergevars ?
We can see it's loaded from a config, and then altered by modules that implement some alter hooks :
$mergevars = Yaml::decode($configuration['mergevars']);
// Allow other modules to alter the merge vars.
// @see hook_mailchimp_lists_mergevars_alter().
$entity_type = 'webform_submission';
\Drupal::moduleHandler()->alter('mailchimp_lists_mergevars', $mergevars, $webform_submission, $entity_type);
\Drupal::moduleHandler()->alter('webform_mailchimp_lists_mergevars', $mergevars, $webform_submission, $this);
First, you may want to check if $configuration['mergevars'] is correctly set.
Then, you can see what is happening and eventually fix $mergevars in your own hook_alter :
function MODULE_mailchimp_lists_mergevars_alter(&$mergevars, &$webform_submission, &$entity_type) {
# debug/fix $mergevars
}
function MODULE_webform_mailchimp_lists_mergevars_alter(&$mergevars, &$webform_submission, &$WebformMailChimpHandler) {
# debug/fix $mergevars
}
The issue is likely caused by a wrong mergevars alteration in one of the alter hooks. Note variables are passed by reference.
If you find that $mergevars actually is an array of string (is it seems all good) inside your module alter hook, it means that another contrib module acting after yours (@see module priority) is causing the issue.