php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #39469 FILTER_VALIDATE_EMAIL does not accept IDN domain names
Submitted: 2006-11-11 11:19 UTC Modified: 2016-08-08 10:05 UTC
Votes:9
Avg. Score:3.2 ± 1.5
Reproduced:6 of 6 (100.0%)
Same Version:1 (16.7%)
Same OS:1 (16.7%)
From: christoph at ziegenberg dot de Assigned:
Status: Re-Opened Package: Filter related
PHP Version: 5.2.0 OS: WinXP SP2
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2006-11-11 11:19 UTC] christoph at ziegenberg dot de
Description:
------------
The filter FILTER_VALIDATE_EMAIL does not accept IDN domain names, so valid email addresses are not accepted, the punycode version works.

I know the check for this is a little bit complex, because the allowed chars in the domain name depend on the TLD. 

I think the current behavior is okay as default, but there should be an option to allow IDN domain names.

Reproduce code:
---------------
<?php
var_dump(filter_var('test@t?t?r?t??.de', FILTER_VALIDATE_EMAIL));
var_dump(filter_var('test@xn--ttrt-loabbba.de', FILTER_VALIDATE_EMAIL));
?>

Expected result:
----------------
string(...) "..."
string(...) "..."

Actual result:
--------------
bool(false)
string(...) "..."

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-09-27 05:13 UTC] aharvey@php.net
-Status: Open +Status: Closed -Package: Feature/Change Request +Package: *General Issues -Assigned To: +Assigned To: aharvey
 [2010-09-27 05:13 UTC] aharvey@php.net
This has since been fixed, and works in the current 5.2 and 5.3 releases.
 [2013-03-04 14:42 UTC] dean at deansas dot org
This doesn't seem to be fixed. Please reopen.

dean@ernie:~$ php -r "var_dump(filter_var('fred@b├╝cher.ch', 
FILTER_VALIDATE_EMAIL));"
bool(false)


Using:
PHP 5.3.10-1ubuntu3.5 with Suhosin-Patch (cli) (built: Jan 18 2013 23:40:19) 
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
 [2014-07-15 16:46 UTC] drogolov at gmail dot com
Any news? Still not fixed.
 [2014-07-17 17:57 UTC] aharvey@php.net
-Status: Closed +Status: Re-Opened -Package: *General Issues +Package: Filter related -Assigned To: aharvey +Assigned To:
 [2014-07-19 18:33 UTC] pajoye@php.net
For the record, it never aimed to support punycode. One has to convert them first.
 [2015-03-20 01:46 UTC] ppaisndud at gmail dot com
Similar to https://bugs.php.net/bug.php?id=65027 which suggests to use idn_to_ascii from pecl intl 

http://3v4l.org/THEZj
 [2016-08-08 10:05 UTC] cmb@php.net
> For the record, it never aimed to support punycode. One has to
> convert them first.

Wouldn't it make sense to do the conversion automatically, if
ext/intl is available? Otherwise we should mark this as WONTFIX.
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Fri Aug 23 05:01:27 2019 UTC