|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
Patchesfix-idn-filter-validate-email (last revision 2011-11-25 08:41 UTC by enderstd at gmail dot com)Pull RequestsHistoryAllCommentsChangesGit/SVN commits
[2011-11-29 08:24 UTC] enderstd at gmail dot com
-Status: Open
+Status: Closed
[2011-11-29 08:24 UTC] enderstd at gmail dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 04:00:01 2025 UTC |
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)