Bug #69844 [Opn->Nab]: FILTER_VALIDATE_EMAIL rejects unusual but valid addresses
| From: | rasmus@php.net | Date: | Tue, 16 Jun 2015 14:39:44 +0000 |
| Subject: | Bug #69844 [Opn->Nab]: FILTER_VALIDATE_EMAIL rejects unusual but valid addresses | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-193569@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=69844&edit=1
ID: 69844
Updated by: rasmus@php.net
Reported by: grzegorz129 at gmail dot com
Summary: FILTER_VALIDATE_EMAIL rejects unusual but valid
addresses
-Status: Open
+Status: Not a bug
Type: Bug
Package: Filter related
Operating System: Any
PHP Version: 7.0.0alpha1
Block user comment: N
Private report: N
New Comment:
This is working as documented. We validate according to RFC822 and don't allow IDNs. The simple
work-around if you want IDN support is to call idn_to_ascii() first.
Previous Comments:
------------------------------------------------------------------------
[2015-06-15 22:22:53] grzegorz129 at gmail dot com
Description:
------------
Some weird (but still perfectly valid) e-mail addresses are rejected by filter_var with
FILTER_VALIDATE_EMAIL filter.
I've got sample data from https://en.wikipedia.org/wiki/Email_address#Valid_email_addresses
While support for comments was mention before I was unable to find any references to spaces.
Test script:
---------------
$emails = array(
'test@example.com',
'test.derp@example.com',
'test+nick@example.com',
'abc."defghi".xyz@example.com',
'"abcdefghixyz"@example.com',
'jsmith@[192.168.2.1]',
'jsmith@[IPv6:2001:db8::1]',
'long.but.still.perfectly.valid.email.address@on.even.longer.domain.name.owned.by.some.weird.name.company.which.name.you.cannot.pronounce.com',
'other.email-with-dash@example.com',
'"much.more unusual"@example.com',
'"very.unusual.@.unusual.com"@example.com',
'"very.(),:;<>[]\".VERY.\"very@\\
\"very\".unusual"@strange.example.com',
'admin@mailserver1 (local domain name with no TLD)',
'#!$%&\'*+-/=?^_`{}|~@example.org',
'"()<>[]:,;@\\\"!#$%&\'*+-/=?^_`{}| ~.a"@example.org',
'" "@example.org (space between the quotes)',
'âââ@example.com (Unicode characters in local part)',
'âââ@âââ.com (Unicode characters in domain part)',
'new@domain.pizza'
);
foreach ($emails as $email) {
echo (filter_var($email, FILTER_VALIDATE_EMAIL)) ?
"[+] Email $email is valid\n" :
"[-] Email $email is NOT valid\n";
}
Actual result:
--------------
http://3v4l.org/qTsVc
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=69844&edit=1