summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2009-02-02 23:51:58 +0000
committerIlia Alshanetsky <iliaa@php.net>2009-02-02 23:51:58 +0000
commit6131780061dce3d9526d5e70336a25d78bde6dcb (patch)
tree84614f8b0bef73f9dec947d2a530b95329c78afe
parent1ad22f19e2e0bfe91e9220e450a03f90b85b1a36 (diff)
downloadphp-git-6131780061dce3d9526d5e70336a25d78bde6dcb.tar.gz
MFB: Fixed bug #47282 (FILTER_VALIDATE_EMAIL is marking valid email
addresses as invalid)
-rw-r--r--NEWS2
-rw-r--r--ext/filter/logical_filters.c2
-rw-r--r--ext/filter/tests/016.phpt8
3 files changed, 8 insertions, 4 deletions
diff --git a/NEWS b/NEWS
index ff91db4c6a..f64436c641 100644
--- a/NEWS
+++ b/NEWS
@@ -17,6 +17,8 @@ PHP NEWS
- Fixed bug in xml_error_string() which resulted in messages being
off by one. (Scott)
+- Fixed bug #47282 (FILTER_VALIDATE_EMAIL is marking valid email addresses
+ as invalid). (Ilia)
- Fixed bug #47220 (segfault in dom_document_parser in recovery mode). (Rob)
- Fixed bug #47217 (content-type is not set properly for file uploads).
(Ilia)
diff --git a/ext/filter/logical_filters.c b/ext/filter/logical_filters.c
index 4e64aabfef..2df6265df2 100644
--- a/ext/filter/logical_filters.c
+++ b/ext/filter/logical_filters.c
@@ -469,7 +469,7 @@ void php_filter_validate_url(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
void php_filter_validate_email(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
{
/* From http://cvs.php.net/co.php/pear/HTML_QuickForm/QuickForm/Rule/Email.php?r=1.4 */
- const char regexp[] = "/^((\\\"[^\\\"\\f\\n\\r\\t\\b]+\\\")|([\\w\\!\\#\\$\\%\\&\\'\\*\\+\\-\\~\\/\\^\\`\\|\\{\\}]+(\\.[\\w\\!\\#\\$\\%\\&\\'\\*\\+\\-\\~\\/\\^\\`\\|\\{\\}]+)*))@((\\[(((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9])))\\])|(((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9])))|((([A-Za-z0-9])(([A-Za-z0-9\\-])*([A-Za-z0-9]))?\\.)+[A-Za-z\\-]+))$/D";
+ const char regexp[] = "/^((\\\"[^\\\"\\f\\n\\r\\t\\b]+\\\")|([\\w\\!\\#\\$\\%\\&\\'\\*\\+\\-\\~\\/\\^\\`\\|\\{\\}]+(\\.[\\w\\!\\#\\$\\%\\&\\'\\*\\+\\-\\~\\/\\^\\`\\|\\{\\}]*)*))@((\\[(((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9])))\\])|(((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9])))|((([A-Za-z0-9])(([A-Za-z0-9\\-])*([A-Za-z0-9]))?\\.?)+[A-Za-z\\-]*))$/D";
pcre *re = NULL;
pcre_extra *pcre_extra = NULL;
diff --git a/ext/filter/tests/016.phpt b/ext/filter/tests/016.phpt
index e013c550a6..d7e33b800d 100644
--- a/ext/filter/tests/016.phpt
+++ b/ext/filter/tests/016.phpt
@@ -13,7 +13,8 @@ $values = Array(
'test@com',
'@',
'[]()/@example.com',
-'QWERTYUIOPASDFGHJKLZXCVBNM@QWERTYUIOPASDFGHJKLZXCVBNM.NET',
+'QWERTYUIOPASDFGHJKLZXCVBNM@QWERTYUIOPASDFGHJKLZXCVBNM.NET',
+'e.x.a.m.p.l.e.@example.com'
);
foreach ($values as $value) {
var_dump(filter_var($value, FILTER_VALIDATE_EMAIL));
@@ -27,8 +28,9 @@ string(17) "abuse@example.com"
bool(false)
bool(false)
bool(false)
-bool(false)
+string(8) "test@com"
bool(false)
bool(false)
string(57) "QWERTYUIOPASDFGHJKLZXCVBNM@QWERTYUIOPASDFGHJKLZXCVBNM.NET"
-Done
+string(26) "e.x.a.m.p.l.e.@example.com"
+Done \ No newline at end of file