Re: Trailing dot in email (Was: Re: Possible bug according to Rasmus Leerdorf)

2010-04-05 10:57, Thomas Broyer skrev:

> RFC2822 doesn't place any rule on what a local-part can be, it's just
> that it must be quoted if it doesn't match the dot-atom syntax.
> I had an address whose local-part was ".tom." and it worked very well,
> except for those badly-authored web forms that chose to rule it out.
> In mails, it had to be written, according to the RFC,
> ".tom."@blahblahblah but it's just a matter of syntax and escaping.

As indeed FILTER_VALIDATE_EMAIL will allow with Rasmus' fix. It does 
however, according to the rules, differentiate between what is allowed 
between quotes and what is allowed without quotes.

// $r = The new regexp used in PHP internally
php > echo preg_match($r, '".tom."@ff.com');
1
php > echo preg_match($r, '.tom.@ff.com');
0

The fix is here:

http://svn.php.net/viewvc/php/php-src/branches/PHP_5_2/ext/filter/logical_filters.c?r1=297350&r2=297349&pathrev=297350


> I can't see any reason that this would be different for web forms used
> to collect email addresses (I'd just expect them to quote the
> local-part if it doesn't match the 'atom' production)

Indeed, but at the moment such quoting is not needed. The solution I 
proposed was thus a bit hasty to suggest, since it was too restrictive. 
The solution in the spec right now is however too permissive.


-- 
Lars Gunther
http://keryx.se/
http://twitter.com/itpastorn/
http://itpastorn.blogspot.com/

Received on Monday, 5 April 2010 13:00:18 UTC