|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2021-04-15 15:37 UTC] cmb@php.net
-Status: Open
+Status: Duplicate
-Assigned To:
+Assigned To: cmb
[2021-04-15 15:37 UTC] cmb@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 16 01:00:01 2025 UTC |
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