Bug #60381 [NEW]: FILTER_VALIDATE_EMAIL invalid punycode regexp
From:
Operating system:
PHP version: 5.3.8
Package: Filter related
Bug Type: Bug
Bug description:FILTER_VALIDATE_EMAIL invalid punycode regexp
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 bug report at https://bugs.php.net/bug.php?id=60381&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=60381&r=trysnapshot54
Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=60381&r=trysnapshot53
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=60381&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=60381&r=fixed
Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=60381&r=needdocs
Fixed in release: https://bugs.php.net/fix.php?id=60381&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=60381&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=60381&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=60381&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=60381&r=support
Expected behavior: https://bugs.php.net/fix.php?id=60381&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=60381&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=60381&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=60381&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=60381&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=60381&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=60381&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=60381&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=60381&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=60381&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=60381&r=mysqlcfg
Thread (2 messages)
- enderstd at gmail dot com