php.net |  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: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: jachin at clockwork dot net
New email:
PHP Version: OS:

 

 [2009-02-02 21:56 UTC] jachin at clockwork dot net
Description:
------------
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:

e.x.a.m.p.l.e.@example.com
a@com






Reproduce code:
---------------
<?php

$wacky_but_valid_emails[] = 'e.x.a.m.p.l.e.@example.com';
$wacky_but_valid_emails[] = 'a@com';


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

?>

Expected result:
----------------
e.x.a.m.p.l.e.@example.com : bool(false)
a@com : bool(false)

Actual result:
--------------
e.x.a.m.p.l.e.@example.com : string(e.x.a.m.p.l.e.@example.com)
a@com : string(a@com)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-02-02 23:18 UTC] jani@php.net
Note: the expected = actual result and actual = expected in above 
report.
 [2009-02-02 23:52 UTC] iliaa@php.net
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
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Dec 03 08:01:28 2024 UTC