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("[email protected]", 
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("[email protected]", 
FILTER_VALIDATE_EMAIL));

Expected result:
----------------
string(35) "[email protected]"

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


------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=60381&edit=1

Reply via email to