#47282 [Opn->Ver]: FILTER_VALIDATE_EMAIL is marking potentially valid emails as invalid

From: Date: Mon, 02 Feb 2009 23:18:41 +0000
Subject: #47282 [Opn->Ver]: FILTER_VALIDATE_EMAIL is marking potentially valid emails as invalid
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-133404@lists.php.net to get a copy of this message
 ID:               47282
 Updated by:       jani@php.net
 Reported By:      jachin at clockwork dot net
-Status:           Open
+Status:           Verified
 Bug Type:         Filter related
-Operating System: Gentoo
+Operating System: *
-PHP Version:      5.2.8
+PHP Version:      5.*,6 CVS-2009-02-02
 New Comment:

Note: the expected = actual result and actual = expected in above 
report.


Previous Comments:
------------------------------------------------------------------------

[2009-02-02 21:56:18] 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)


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=47282&edit=1



Thread (3 messages)

« previous php.bugs (#133404) next »