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

Bug #302 Rule/Email.php regex missing +
Submitted: 2003-11-26 09:38 UTC Modified: 2004-01-03 11:14 UTC
From: hgs at cs dot columbia dot edu Assigned: mansion
Status: Closed Package: HTML_QuickForm
PHP Version: 4.3.3 OS: Solaris
Roadmaps: (Not assigned)    
Subscription  


 [2003-11-26 09:38 UTC] hgs at cs dot columbia dot edu
Description: ------------ The regex in Rule/email.php does not allow a + in the user part of the email address (e.g., foo+bar@example.com). However, this is perfectly legal according to RFC 2821 and RFC 2822: From RFC 2822, local-part can be a dotted concatenation of atext, where atext is: atext = ALPHA / DIGIT / ; Any character except controls, "!" / "#" / ; SP, and specials. "$" / "%" / ; Used for atoms "&" / "'" / "*" / "+" / "-" / "/" / "=" / "?" / "^" / "_" / "`" / "{" / "|" / "}" / "~"

Comments

 [2003-12-02 15:03 UTC] avb
The email is pretty dumb, indeed. To more properly support all addresses possible according to RFC, we'll have either to use PEAR's Mail_RFC822 class or code something like regex-of-death from Friedl's book on regexes.
 [2003-12-18 09:18 UTC] bmansion at mamasam dot com
I used this one instead, it supports all that weird characters you mentioned: /^((\"[^\"\f\n\r\t\v\b]+\")|([\w\!\#\$\%\&\'\*\+\-\~\/\^\`\|\{\}]+(\.[\w\!\#\$\%\&\'\*\+\-\~\/\^\`\|\{\}]+)*))@((\[(((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9])))\])|(((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9])))|((([A-Za-z0-9\-])+\.)+[A-Za-z\-]+))$/
 [2004-01-03 11:14 UTC] mansion at php dot net
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.