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
{{ message }}
Repository navigation
US Phone validation will accept phone numbers with letters #101
The regex is matching anywhere between 0 and 3 characters per input field except the last field which is 0-4. This means that phone numbers with a letter in them will still pass validation because the regex will still match 3 digits.
if ( ! preg_match( '/[0-9]{0,3}-[0-9]{0,3}-[0-9]{0,4}/A', $opt_val ) ) {
Solution
Change the regex to
Lock in the correct amount of characters
Start to end matching to enforce full string matches
/^[0-9]{3}-[0-9]{3}-[0-9]{4}$/
Steps to Reproduce
Change the phone format in the test user Mailchimp account to US format
Click the "Update List" button in the Mailchimp admin
Submit a form with a phone number that contains a letter
Activity
MaxwellGarceau commentedon Jan 3, 2025
Related to #104