Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.8.6

Bug #2662 Invalid email addresses are validated
Submitted: 2004-11-01 17:01 UTC
From: mitchenall at gmail dot com Assigned: dufuz
Status: Closed Package: Validate
PHP Version: Irrelevant OS: Any
Roadmaps: 0.8.0    
Subscription  


 [2004-11-01 17:01 UTC] mitchenall at gmail dot com
Description: ------------ The regex for testing the email address is not correct as it will accept addresses with trailing dots. Reproduce code: --------------- In Validate.php, the following changed regex seems to work a little better... function email($email, $check_domain = false) { if($check_domain){ } if (ereg('^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+'.'@'. '[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+'. '(\.[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+)+$', $email)) Note, the 3rd part of the regex now has the '.' from the 2nd part at the beginning of the additional parenthesised block and this block and be repeated one or more times. Also, the dot is removed from the character class in the 3rd block. Currently, the following tests return true... if(Validate::email('mark@mitchenall.com.')) { echo 'valid' ; } else { echo 'invalid' ; } Expected result: ---------------- invalid Actual result: -------------- valid

Comments

 [2004-11-08 09:12 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!