com web/bugs: Validate email address with filter_var instea d of regexp: include/functions.php
| From: | sobak@php.net | Date: | Sun, 18 May 2014 16:37:07 +0000 |
| Subject: | com web/bugs: Validate email address with filter_var instea d of regexp: include/functions.php | ||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-18935@lists.php.net to get a copy of this message | ||
Commit: 5d4b022d765691fc2ed93b663ec57fabce57ee33
Author: Sobak <msobaczewski@gmail.com> Sun, 18 May 2014 18:37:07 +0200
Parents: bf3170a7e3c357421467bdf80807704214686b07
Branches: master
Link: http://git.php.net/?p=web/bugs.git;a=commitdiff;h=5d4b022d765691fc2ed93b663ec57fabce57ee33
Log:
Validate email address with filter_var instead of regexp
Changed paths:
M include/functions.php
Diff:
diff --git a/include/functions.php b/include/functions.php
index 6cb081d..5f0dfe1 100644
--- a/include/functions.php
+++ b/include/functions.php
@@ -1280,7 +1280,7 @@ function is_valid_email($email, $phpnet_allowed = true)
return false;
}
}
- return (bool) preg_match("/^[.\\w+-]+@[.\\w-]+\\.\\w{2,}\z/i", $email);
+ return (bool)filter_var($email, FILTER_VALIDATE_EMAIL);
}
/**