On 04/02/2010 01:22 PM, Martin Jansen wrote: > On 02.04.10 19:56, Rasmus Lerdorf wrote: >> rasmus Fri, 02 Apr 2010 17:56:37 +0000 >> >> Revision: http://svn.php.net/viewvc?view=revision&revision=297350 >> >> Log: >> Update the FILTER_VALIDATE_EMAIL filter to fix bug #49576 > > I'm referring to the following comment: > >> + * However, it is not identical. I changed it to only consider >> routeable >> + * addresses as valid. Michael's regex considers a...@b a valid address >> + * which conflicts with section 2.3.5 of RFC 5321 which states that: > > Is this actually correct behavior? The top-level domain for the Vatican > e.g. has MX records, so at least theoretically p...@va is a valid and > routeable email address, no matter what RFC 5321 states. > > $ host -t MX va > va mail is handled by 10 lists.vatican.va. > va mail is handled by 20 paul.vatican.va. > va mail is handled by 50 proxy2.urbe.it. > va mail is handled by 90 john.vatican.va.
Yes, it is an interesting question, and if you look at the IETF discussion(*) on it you will see that we can discuss it for months and not come to a conclusion. Essentially the IETF failed to disallow it early on, so we have ended up with some fringe TLDs with MX records. A bunch of RFCs, not referring directly to email talk about single word domains being local. If you go back in Internet history you can read about the problems caused when the .cs tld was introduced and how it conflicted with a bunch of email configurations at universities who had u...@cs go to the CS department. So, in order to attempt to rescue the sinking ship, they have tried to patch this problem with that clause in RFC 5321. Personally I think they should allow a trailing . to indicate a tld. So it would be p...@va. which would be distinct from a local machine named "va" but the email RFCs do not allow that. I took a more pragmatic PHP approach here. I think if people are validating email addresses they want to know if it is likely to be a routeable address and will probably want f...@bar to be rejected despite the fact that there are a handful of addresses in the world that might potentially route that are of that form. Of course if the isp that does the mail delivery has a "va" machine in their local network chances are p...@va isn't going to leave the network depending on how the MTA is configured. And since this pragmatic approach actually lines up with the latest RFC on the matter it makes sense to me. (*) http://www.ietf.org/mail-archive/web/ietf/current/msg52148.html Click thread-next (many many times) and you will see the discussion turn to MX records on TLDs. -Rasmus -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php