#47282 [NEW]: FILTER_VALIDATE_EMAIL is marking potentially valid emails as invalid
| From: | jachin at clockwork dot net | Date: | Mon, 02 Feb 2009 21:56:19 +0000 |
| Subject: | #47282 [NEW]: FILTER_VALIDATE_EMAIL is marking potentially valid emails as invalid | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-133400@lists.php.net to get a copy of this message | ||
From: jachin at clockwork dot net
Operating system: Gentoo
PHP version: 5.2.8
PHP Bug Type: Filter related
Bug description: FILTER_VALIDATE_EMAIL is marking potentially valid emails as invalid
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 bug report at http://bugs.php.net/?id=47282&edit=1
--
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=47282&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=47282&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=47282&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=47282&r=fixedcvs
Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=47282&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=47282&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=47282&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=47282&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=47282&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=47282&r=support
Expected behavior: http://bugs.php.net/fix.php?id=47282&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=47282&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=47282&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=47282&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=47282&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=47282&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=47282&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=47282&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=47282&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=47282&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=47282&r=mysqlcfg