|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #47282 FILTER_VALIDATE_EMAIL is marking valid email addresses as invalid
Submitted: 2009-02-02 21:56 UTC Modified: 2009-02-02 23:52 UTC
From: jachin at clockwork dot net Assigned:
Status: Closed Package: Filter related
PHP Version: 5.*,6 CVS-2009-02-02 OS: *
Private report: No CVE-ID:
 [2009-02-02 21:56 UTC] jachin at clockwork dot net
I tried to refractor email validation code to use the 
FILTER_VALIDATE_EMAIL filter instead of a regex. Our Unit tests failed, 
because it marked the following email addresses as invalid:

Reproduce code:

$wacky_but_valid_emails[] = '';
$wacky_but_valid_emails[] = 'a@com';

foreach( $wacky_but_valid_emails as $email ) {
        print "$email : ";
        $result = filter_var($email, FILTER_VALIDATE_EMAIL );


Expected result:
---------------- : bool(false)
a@com : bool(false)

Actual result:
-------------- : string(
a@com : string(a@com)


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2009-02-02 23:18 UTC]
Note: the expected = actual result and actual = expected in above 
 [2009-02-02 23:52 UTC]
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2015 The PHP Group
All rights reserved.
Last updated: Sun Nov 29 12:01:29 2015 UTC