Req #65385 [Opn->Dup]: filter_var() with built in idn_to_ascii() support
| From: | cmb@php.net | Date: | Mon, 15 Jun 2015 23:28:35 +0000 |
| Subject: | Req #65385 [Opn->Dup]: filter_var() with built in idn_to_ascii() support | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-193531@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=65385&edit=1
ID: 65385
Updated by: cmb@php.net
Reported by: juergen78 at gmail dot com
Summary: filter_var() with built in idn_to_ascii() support
-Status: Open
+Status: Duplicate
Type: Feature/Change Request
-Package: filter
+Package: Filter related
Operating System: irrelevant
PHP Version: Irrelevant
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
Duplicate of request #39469.
Previous Comments:
------------------------------------------------------------------------
[2013-09-08 21:42:03] cmbecker69 at gmx dot de
Related To: Bug #65630
------------------------------------------------------------------------
[2013-08-03 17:03:58] juergen78 at gmail dot com
text corr.
------------------------------------------------------------------------
[2013-08-03 15:46:31] juergen78 at gmail dot com
Description:
------------
There are filter_var() and idn_to_ascii().
- filter_var('bob@example.com', FILTER_VALIDATE_EMAIL);
- idn_to_ascii()
But the filter_var('bob@example.com', 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üller.de";
var_dump( validate_email($mail) );
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=65385&edit=1