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    
Comments Add Comment Add patch

Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem : 44 + 15 = ?

 [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('')) { echo 'valid' ; } else { echo 'invalid' ; } Expected result: ---------------- invalid Actual result: -------------- valid


 [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 In case this was a 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.