Bug #80957 [Opn->Dup]: FILTER_VALIDATE_EMAIL and FILTER_SANITIZE_EMAIL are not unicode safe

From: Date: Thu, 15 Apr 2021 15:37:49 +0000
Subject: Bug #80957 [Opn->Dup]: FILTER_VALIDATE_EMAIL and FILTER_SANITIZE_EMAIL are not unicode safe
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-233443@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=80957&edit=1

 ID:                 80957
 Updated by:         cmb@php.net
 Reported by:        gG5aKfc4w53QZ2Lq3dHWwY at mailinator dot com
 Summary:            FILTER_VALIDATE_EMAIL and FILTER_SANITIZE_EMAIL are
                     not unicode safe
-Status:             Open
+Status:             Duplicate
 Type:               Bug
 Package:            *Unicode Issues
 PHP Version:        8.0.3
-Assigned To:        
+Assigned To:        cmb
 Block user comment: N
 Private report:     N

 New Comment:

Duplicate of request #39469.


Previous Comments:
------------------------------------------------------------------------
[2021-04-15 15:28:11] gG5aKfc4w53QZ2Lq3dHWwY at mailinator dot com

Description:
------------
Using FILTER_VALIDATE_EMAIL and FILTER_SANITIZE_EMAIL produces incorrect results. In the first case,
valid unicode emails are deemed invalid. In the second case, unicode characters are stripped from a
valid unicode email.

Test script:
---------------
<?php

$email = 'Müller@example.org';
$isValid = filter_var($email, FILTER_VALIDATE_EMAIL);
if (!$isValid) {
    echo "Uh-oh, PHP thinks unicode email addresses are invalid \n";
}

$sanitized = filter_var($email, FILTER_SANITIZE_EMAIL);
if ($sanitized !== $email) {
    echo "Not only that, but it destroys valid emails while sanitizing: $sanitized \n";
}


Expected result:
----------------
No output is expected.

Actual result:
--------------
Uh-oh, PHP thinks unicode email addresses are invalid 
Not only that, but it destroys valid emails while sanitizing: Mller@example.org 



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



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


Thread (2 messages)

« previous php.bugs (#233443) next »