PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » HTML » HTML_QuickForm » Bug #302

Rule/Email.php regex missing +

Details

Submitted2003-11-26 14:38 UTC
Fromhgs at cs dot columbia dot edu
Assignedmansion
StatusClosed
PackageHTML_QuickForm
PHP Version4.3.3
OSSolaris
Roadmaps(Not assigned)

Comments

[2003-11-26 14: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
"&" / "'" /
"*" / "+" /
"-" / "/" /
"=" / "?" /
"^" / "_" /
"`" / "{" /
"|" / "}" /
"~"

[2003-12-18 14: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 16: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.