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  
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes. If this is not your bug, you can add a comment by following this link. If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
2006-12-27 04:45 UTC
Package:
Bug Type:
Summary:
From: mitchenall at gmail dot com
New email:
PHP Version: Package Version: OS:

 

 [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] dufuz
This bug has been fixed in CVS. In case this was a documentation problem, the fix will show up at the end of next Sunday (CET) on pear.php.net. In case this was a pear.php.net website problem, the change will show up on the website in short time. Thank you for the report, and for helping us make PEAR better.