Bug #72244 [Opn]: filter_var does not support unicode for local part of emails

From: Date: Fri, 20 May 2016 13:35:20 +0000
Subject: Bug #72244 [Opn]: filter_var does not support unicode for local part of emails
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-201207@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=72244&edit=1 ID: 72244 Updated by: derick@php.net Reported by: iquito at gmx dot net Summary: filter_var does not support unicode for local part of emails Status: Open Type: Bug Package: Filter related PHP Version: 7.0.6 Block user comment: N Private report: N New Comment: If this gets added, it should be opt-in with a flag. Previous Comments: ------------------------------------------------------------------------ [2016-05-20 12:47:57] iquito at gmx dot net As an addition: according to the new RFCs, the domain part can also be unicode. This means unicode should be supported in both local part and domain part of the email address, and the idn_to_ascii should no longer be necessary if filter_var correctly supports the new RFCs. ------------------------------------------------------------------------ [2016-05-19 18:20:33] iquito at gmx dot net Description: ------------ filter_var is not up-to-date anymore: the local part of an email address can contain any unicode characters as of RFC 6531, and filter_var should confirm such email addresses as valid. Test script: --------------- filter_var('bücher@example.net', FILTER_VALIDATE_EMAIL); => returns false, even though this is a valid address. It would also be nice to handle UTF8 domains internally (doing a idn_to_ascii on the domain if necessary, just to check the address, not when returning the address), to automatically handle UTF8 in domain names as well as in the local part, because it is not straightforward that you have to pre-process the email address yourself in that way. Validation should be as easy as possible, and doing the idn_to_ascii in filter_var would not have any drawbacks, while the current implementation has a huge drawback in that you have to split up the email address, process the domain, and reconstruct the address just to pass it to filter_var - and you have to know all that & do it correctly. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=72244&edit=1

« previous php.bugs (#201207) next »