[wp-trac] [WordPress Trac] #31992: Unicode Email Addresses

WordPress Trac noreply at wordpress.org
Tue Feb 9 22:59:05 UTC 2021


#31992: Unicode Email Addresses
--------------------------+---------------------
 Reporter:  ysalame       |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:
Component:  Formatting    |     Version:
 Severity:  normal        |  Resolution:
 Keywords:  is-email      |     Focuses:
--------------------------+---------------------

Comment (by liedekef):

 This patch does not solve the problem with e.g. "测试5@普遍接受-测试.世界"
 A more simpler approach would be to use php FILTER_VALIDATE_EMAIL (which
 doesn't work for unicode, but we add the second if for that) here. An
 example validation function could look like this:

 {{{
    if (filter_var($email, FILTER_VALIDATE_EMAIL)) {
         return true;
    } elseif (preg_match("/^([\w\-\.\+]+@([\w\-]+\.)+[\w\-]{2,63})?$/u",
 $email)) {
         return true;
    } else {
         return false;
    }
 }}}

 I guess even more simple would be to use just the regex:
 {{{
    if (preg_match("/^([\w\-\.\+]+@([\w\-]+\.)+[\w\-]{2,63})?$/u", $email))
 {
         return true;
    } else {
         return false;
    }
 }}}

 In any case is_email currently blocks unicode email addresses and should
 get fixed.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/31992#comment:9>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list