Bug #80957 [NEW]: FILTER_VALIDATE_EMAIL and FILTER_SANITIZE_EMAIL are not unicode safe

From: Date: Thu, 15 Apr 2021 15:28:11 +0000
Subject: Bug #80957 [NEW]: FILTER_VALIDATE_EMAIL and FILTER_SANITIZE_EMAIL are not unicode safe
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-233442@lists.php.net to get a copy of this message
From:             gG5aKfc4w53QZ2Lq3dHWwY at mailinator dot com
Operating system: 
PHP version:      8.0.3
Package:          *Unicode Issues
Bug Type:         Bug
Bug description:FILTER_VALIDATE_EMAIL and FILTER_SANITIZE_EMAIL are not unicode safe

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 bug report at https://bugs.php.net/bug.php?id=80957&edit=1
-- 
Fix committed:                    https://bugs.php.net/fix.php?id=80957&r=fixed
Fixed in release:                 https://bugs.php.net/fix.php?id=80957&r=alreadyfixed
Need backtrace:                   https://bugs.php.net/fix.php?id=80957&r=needtrace
Need Reproduce Script:            https://bugs.php.net/fix.php?id=80957&r=needscript
Try newer version:                https://bugs.php.net/fix.php?id=80957&r=oldversion
Not developer issue:              https://bugs.php.net/fix.php?id=80957&r=support
Expected behavior:                https://bugs.php.net/fix.php?id=80957&r=notwrong
Not enough info:                  https://bugs.php.net/fix.php?id=80957&r=notenoughinfo
Submitted twice:                  https://bugs.php.net/fix.php?id=80957&r=submittedtwice
register_globals:                 https://bugs.php.net/fix.php?id=80957&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=80957&r=phptooold
Daylight Savings:                 https://bugs.php.net/fix.php?id=80957&r=dst
IIS Stability:                    https://bugs.php.net/fix.php?id=80957&r=isapi
Install GNU Sed:                  https://bugs.php.net/fix.php?id=80957&r=gnused
Floating point limitations:       https://bugs.php.net/fix.php?id=80957&r=float
No Zend Extensions:               https://bugs.php.net/fix.php?id=80957&r=nozend
MySQL Configuration Error:        https://bugs.php.net/fix.php?id=80957&r=mysqlcfg


Thread (2 messages)

« previous php.bugs (#233442) next »