You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following conditions cause a PHP fatal error on form submission
Phone number is set to US style in the Mailchimp account
Phone number is NOT included as a merge field in the WP plugin
Explanation
I haven't investigated, but I suspect that mailchimp_sf_merge_validate_phone is activating because the Phone Number merge field is set to US style, but since that field is not included the function is receiving invalid input.
The solution is most likely as simple as adding a conditional check for the input the function needs. In addition, instead of a fatal error being thrown there should at worst be a failed validation check.
PHP Error Log
Fatal error: Uncaught TypeError: array_filter(): Argument #1 ($array) must be of type array, string given in /var/www/html/wp-content/plugins/wordpress/mailchimp.php:1053
Stack trace:
#0 /var/www/html/wp-content/plugins/wordpress/mailchimp.php(1053): array_filter('')
#1 /var/www/html/wp-content/plugins/wordpress/mailchimp.php(1008): mailchimp_sf_merge_validate_phone('', Array)
#2 /var/www/html/wp-content/plugins/wordpress/mailchimp.php(854): mailchimp_sf_merge_submit(Array)
#3 /var/www/html/wp-content/plugins/wordpress/mailchimp.php(245): mailchimp_sf_signup_submit()
#4 /var/www/html/wp-includes/class-wp-hook.php(324): mailchimp_sf_request_handler('')
#5 /var/www/html/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array)
#6 /var/www/html/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#7 /var/www/html/wp-settings.php(704): do_action('init')
#8 /var/www/html/wp-config.php(151): require_once('/var/www/html/w...')
#9 /var/www/html/wp-load.php(50): require_once('/var/www/html/w...')
#10 /var/www/html/wp-blog-header.php(13): require_once('/var/www/html/w...')
#11 /var/www/html/index.php(17): require('/var/www/html/w...')
#12 {main}
thrown in /var/www/html/wp-content/plugins/wordpress/mailchimp.php on line 1053
Steps to Reproduce
Set the phone format in the test Mailchimp account (/lists/settings/merge-tags) to US style
Select the "Update List" button to refresh the Mailchimp data with WP
Ensure that Phone Number is not an included merge field. The error will only occur when Phone Number is not included in the form.
Submit a form submission using only email (any merge field is okay and the error should occur regardless)
Describe the bug
The following conditions cause a PHP fatal error on form submission
Explanation
I haven't investigated, but I suspect that
mailchimp_sf_merge_validate_phone
is activating because the Phone Number merge field is set to US style, but since that field is not included the function is receiving invalid input.The solution is most likely as simple as adding a conditional check for the input the function needs. In addition, instead of a fatal error being thrown there should at worst be a failed validation check.
PHP Error Log
Steps to Reproduce
Screenshots, screen recording, code snippet
us-phone-fatal-error-when-merge-field-not-included.mov
Environment information
No response
WordPress information
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: