• Resolved Newt Labs

    (@newtlabs)


    Hi,

    I’m experiencing a fatal error when using the Mailchimp for WP and WPForms integration. The issue occurs in /wp-content/plugins/mailchimp-for-wp/integrations/wpforms/class-field.php on line 196 and seems to be caused by an array_merge() function trying to merge a null value.Error Message:

    Fatal error: Uncaught TypeError: array_merge(): Argument #2 must be of type array, null given in /wp-content/plugins/mailchimp-for-wp/integrations/wpforms/class-field.php:196

    It looks like $field_atts is sometimes null, which causes this issue in PHP 8+.

    Suggested Fix:

    To prevent this error, I updated the code on line 196 to ensure $field_atts is always treated as an array:

    Original Code:

    $field_atts = array_merge([
    'input_class' => [],
    'input_id' => [],
    ], $field_atts);

    Fixed Code:

    $field_atts = array_merge([
    'input_class' => [],
    'input_id' => [],
    ], is_array($field_atts) ? $field_atts : []);

    This change ensures $field_atts is always an array, preventing the TypeError.

    Could you confirm if this is a valid fix and whether an official update will include it? Let me know if you need any additional details.

    Thanks!

Viewing 1 replies (of 1 total)
  • Plugin Contributor Lap

    (@lapzor)

    Hi,

    Thank you for reporting the issue.

    It was caused by some large changes to the recent Wp Forms plugin update.

    Please update to Mailchimp for WordPress v4.10.2, that should solve the problem.

    Thanks again for reporting the issue, let us know if the problem isn’t solved for you in the latest version of Mailchimp for WordPress.

    Kind regards,

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.