|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #79802 VALIDATE_EMAIL has another behaviour as SANITIZE_EMAIL
Submitted: 2020-07-07 07:20 UTC Modified: 2021-08-05 17:36 UTC
From: Assigned: cmb (profile)
Status: Not a bug Package: Filter related
PHP Version: Irrelevant OS: Debian 10.4
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
New email:
PHP Version: OS:


 [2020-07-07 07:20 UTC]
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:

$email = '';
var_dump(\filter_var($email, FILTER_VALIDATE_EMAIL));
var_dump($email === \filter_var($email, FILTER_SANITIZE_EMAIL));

Expected result:
string(89) ""

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2021-08-05 17:36 UTC]
-Status: Open +Status: Not a bug -Assigned To: +Assigned To: cmb
 [2021-08-05 17:36 UTC]
Well, this is not a bug.  FILTER_SANITIZE_EMAIL is documented[1]

| 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] <>
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 13 01:01:28 2024 UTC