|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-02-02 23:18 UTC] jani@php.net
[2009-02-02 23:52 UTC] iliaa@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 05:00:01 2025 UTC |
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)