|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #69844 FILTER_VALIDATE_EMAIL rejects unusual but valid addresses
Submitted: 2015-06-15 22:22 UTC Modified: 2015-06-16 14:39 UTC
From: grzegorz129 at gmail dot com Assigned:
Status: Not a bug Package: Filter related
PHP Version: 7.0.0alpha1 OS: Any
Private report: No CVE-ID: None
 [2015-06-15 22:22 UTC] grzegorz129 at gmail dot com
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

While support for comments was mention before I was unable to find any references to spaces.

Test script:
$emails = array(
    '"much.more unusual"',
    '"very.(),:;<>[]\".VERY.\"very@\\ \"very\".unusual"',
    'admin@mailserver1 (local domain name with no TLD)',
    '"()<>[]:,;@\\\"!#$%&\'*+-/=?^_`{}| ~.a"',
    '" " (space between the quotes)',
    '☃☃☃ (Unicode characters in local part)',
    '☃☃☃@☃☃☃.com (Unicode characters in domain part)',

foreach ($emails as $email) {
    echo (filter_var($email, FILTER_VALIDATE_EMAIL)) ? 
        "[+] Email $email is valid\n" : 
        "[-] Email $email is NOT valid\n";

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2015-06-16 14:39 UTC]
-Status: Open +Status: Not a bug
 [2015-06-16 14:39 UTC]
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.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Jul 14 08:01:28 2024 UTC