Re: filter_var doesn't support international email addresses

From: Date: Fri, 06 Feb 2015 15:14:54 +0000
Subject: Re: filter_var doesn't support international email addresses
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-82049@lists.php.net to get a copy of this message
j adams wrote on 06/02/2015 00:05:
Please let me know which mailing list address to use if I have sent this to the wrong list. filter_var does not properly validate emails with international characters. For example, this returns FALSE: var_dump(filter_var("Pelé@example.com", FILTER_VALIDATE_EMAIL)); Are there any plans to implement proper validation of email addresses as described in RFC 6530? http://tools.ietf.org/html/rfc6530
Hi, There was a discussion a while back about Internationalized Domain Name support in FILTER_VALIDATE_URL [1], and I believe there was a concern that since not all systems would accept the wider format, allowing them through the existing filter might be unhelpful. This is particularly true in the case of internationalized e-mails, since if I understand it correctly it's an "all or nothing" system, rather than one with a compatible fallback like the "punycode" notation used in domains. The most useful would probably be to add a new filter type which accepted the new format, so that users could choose to accept what they know they can process. If you know of or can create a succinct validity test (e.g. a PCRE-compatible regex) it ought to be fairly easy to add; the existing implementation is here for comparison: http://lxr.php.net/xref/PHP_TRUNK/ext/filter/logical_filters.c#575 [1] http://grokbase.com/t/php/php-internals/149jfzxtq3/internationalized-domain-name-support-in-filter-validate-url Regards, -- Rowan Collins [IMSoP]

« previous php.internals (#82049) next »