php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #65027 FILTER_VALIDATE_EMAIL does not accept IDN domain names
Submitted: 2013-06-13 09:24 UTC Modified: 2016-11-21 15:22 UTC
Votes:2
Avg. Score:4.0 ± 1.0
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: info at iwebsoft dot de Assigned: cmb (profile)
Status: Duplicate Package: Filter related
PHP Version: 5.5.0RC3 OS: PHP 5.3.10-1ubuntu3.6 with Suhos
Private report: No CVE-ID: None
 [2013-06-13 09:24 UTC] info at iwebsoft dot de
Description:
------------
The filter FILTER_VALIDATE_EMAIL does not accept IDN domain names, so valid email addresses are not accepted.

Test script:
---------------
var_dump(filter_var('test@täst.de', FILTER_VALIDATE_EMAIL));

Expected result:
----------------
string(13) "test@täst.de"

Actual result:
--------------
bool(false)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-06-13 14:27 UTC] rasmus@php.net
-Status: Open +Status: Analyzed
 [2013-06-13 14:27 UTC] rasmus@php.net
An easy workaround is to just call idn_to_ascii() on the address you pass to the 
filter.
 [2015-06-15 23:16 UTC] cmb@php.net
-Status: Analyzed +Status: Duplicate -Type: Bug +Type: Feature/Change Request -Package: Mail related +Package: Filter related -Assigned To: +Assigned To: cmb
 [2015-06-15 23:16 UTC] cmb@php.net
Actually, this is not a bug, because the documentation[1] states:

| In general, this validates e-mail addresses against the syntax
| in RFC 822, [...]

However, IDNs are not allowed by RFC 822. Therefore I'm switching
to feature request, and marking this ticket as duplicate of
request #39469.

[1] <http://php.net/manual/en/filter.filters.validate.php>
 [2016-11-21 15:22 UTC] cmb@php.net
> An easy workaround is to just call idn_to_ascii() on the address
> you pass to the filter.

FTR: while this may be sufficient as workaround for the
validation, the result of filter_var() would not be the desired
email address.
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Mon Sep 16 22:01:27 2019 UTC