|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #65385 filter_var() with built in idn_to_ascii() support
Submitted: 2013-08-03 15:46 UTC Modified: 2015-06-15 23:28 UTC
Avg. Score:4.0 ± 0.8
Reproduced:3 of 3 (100.0%)
Same Version:2 (66.7%)
Same OS:2 (66.7%)
From: juergen78 at gmail dot com Assigned: cmb (profile)
Status: Duplicate Package: Filter related
PHP Version: Irrelevant OS: irrelevant
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: juergen78 at gmail dot com
New email:
PHP Version: OS:


 [2013-08-03 15:46 UTC] juergen78 at gmail dot com
There are filter_var() and idn_to_ascii(). 

- filter_var('', FILTER_VALIDATE_EMAIL);
- idn_to_ascii()

But the filter_var('', FILTER_VALIDATE_EMAIL) is not able to check international Domains. So it would be eligible if filter_var() itself can intern e.g. via idn_to_ascii() convert a international Domain bevor check.

This time it is only doable with a workaround - see Below "Test Script"

Test script:
function validate_email($mail)
    if ( ! filter_var($mail, FILTER_VALIDATE_EMAIL) ) {
        $in = explode('@', $mail);
        $in[1] = idn_to_ascii($in[1]);
        return (bool) filter_var(join('@', $in), FILTER_VALIDATE_EMAIL);

    return true;

$mail = "foo@mü";
var_dump( validate_email($mail) ); 


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2013-08-03 17:03 UTC] juergen78 at gmail dot com
-: j dot haus at gmx dot at +: juergen78 at gmail dot com
 [2013-08-03 17:03 UTC] juergen78 at gmail dot com
text corr.
 [2015-06-15 23:28 UTC]
-Status: Open +Status: Duplicate -Package: filter +Package: Filter related -Assigned To: +Assigned To: cmb
 [2015-06-15 23:28 UTC]
Duplicate of request #39469.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Mar 04 04:01:28 2024 UTC