Bug #79802 [Opn->Nab]: VALIDATE_EMAIL has another behaviour as SANITIZE_EMAIL

From: Date: Thu, 05 Aug 2021 17:36:12 +0000
Subject: Bug #79802 [Opn->Nab]: VALIDATE_EMAIL has another behaviour as SANITIZE_EMAIL
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-235622@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=79802&edit=1 ID: 79802 Updated by: cmb@php.net Reported by: cyberline@php.net Summary: VALIDATE_EMAIL has another behaviour as SANITIZE_EMAIL -Status: Open +Status: Not a bug Type: Bug Package: Filter related Operating System: Debian 10.4 PHP Version: Irrelevant -Assigned To: +Assigned To: cmb Block user comment: N Private report: N New Comment: Well, this is not a bug. FILTER_SANITIZE_EMAIL is documented[1] to: | Remove all characters except letters, digits and | !#$%&'*+-=?^_`{|}~@.[]. while FILTER_VALIDATE_EMAIL rejects addresses with local parts of more than 64 bytes (not yet documented, see bug #78598). [1] <https://www.php.net/manual/en/filter.filters.sanitize.php> Previous Comments: ------------------------------------------------------------------------ [2020-07-07 07:20:01] cyberline@php.net Description: ------------ In all PHP Versions except 5.3.2 the following Script will return false for FILTER_VALIDATE_EMAIL while FILTER_SANITIZE_EMAIL does NOTHING to the input email. While the Provided email is a valid return path, i excpect that VALIDATE_EMAIL will return the string provided and not false. Test script: --------------- <?php $email = '3e9.1c.4UB2NC76N436-3SP03.test-EW3LBM-M6H4BG-0-1.mobil.123456.989=test.de@smtp20.test.com'; var_dump(\filter_var($email, FILTER_VALIDATE_EMAIL)); var_dump($email === \filter_var($email, FILTER_SANITIZE_EMAIL)); Expected result: ---------------- string(89) "3e9.1c.4UB2NC76N436-3SP03.test-EW3LBM-M6H4BG-0-1.mobil.123456.989=test.de@smtp20.test.com" bool(true) Actual result: -------------- bool(false) bool(true) ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=79802&edit=1

« previous php.bugs (#235622) next »