#47282 [Opn->Ver]: FILTER_VALIDATE_EMAIL is marking potentially valid emails as invalid
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)