Bug #60381 [Opn->Csd]: FILTER_VALIDATE_EMAIL invalid punycode regexp
| From: | enderstd at gmail dot com | Date: | Tue, 29 Nov 2011 08:24:44 +0000 |
| Subject: | Bug #60381 [Opn->Csd]: FILTER_VALIDATE_EMAIL invalid punycode regexp | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-165541@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=60381&edit=1
ID: 60381
User updated by: enderstd at gmail dot com
Reported by: enderstd at gmail dot com
Summary: FILTER_VALIDATE_EMAIL invalid punycode regexp
-Status: Open
+Status: Closed
Type: Bug
Package: Filter related
PHP Version: 5.3.8
Block user comment: N
Private report: N
New Comment:
This bug is duplicate for: https://bugs.php.net/bug.php?id=55478
Previous Comments:
------------------------------------------------------------------------
[2011-11-25 08:40:15] enderstd at gmail dot com
Description:
------------
IDN domains can contain hyphens in its name.
When we convert these domain names to punycode we end up with several hyphens in
a row.
For example: xn----7sbbtkohtqhvkc8j.xn--p1ai
(кÑлÑÑÑÑа-пенза.ÑÑ)
Yet it is a valid domain name.
The regexp in the ext/filter/logical_filters.c:525 doens't allow multiple
hyphens but two:
> ... (?:(?:(?:xn--)?[a-z0-9]+( ....
So if I try filter_var("asd@xn----7sbbtkohtqhvkc8j.xn--p1ai",
FILTER_VALIDATE_EMAIL) it returns false.
I think valid regexp will be like (?:xn-(-)+)?[a-z0-9]+ yet I can't be sure
since this regexp is
really scary.
Test script:
---------------
<?php
var_dump(filter_var("asd@xn----7sbbtkohtqhvkc8j.xn--p1ai", FILTER_VALIDATE_EMAIL));
Expected result:
----------------
string(35) "asd@xn----7sbbtkohtqhvkc8j.xn--p1ai"
Actual result:
--------------
bool(false)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=60381&edit=1