#47282 [Ver->Csd]: FILTER_VALIDATE_EMAIL is marking valid email addresses as invalid

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

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.




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

[2009-02-02 23:18:41] jani@php.net

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

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

[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 (#133408) next »