diff options
author | Felipe Pena <felipe@php.net> | 2009-11-15 16:53:40 +0000 |
---|---|---|
committer | Felipe Pena <felipe@php.net> | 2009-11-15 16:53:40 +0000 |
commit | ff62865fc0dc24ad8e018c0db5b9a7343b115d54 (patch) | |
tree | 6d08c6f38dae0b983e966ed35319b7c703d59ff6 | |
parent | ae35c47a4bccf9f9464a518348b81fb0effc5bf6 (diff) | |
download | php-git-ff62865fc0dc24ad8e018c0db5b9a7343b115d54.tar.gz |
- Fixed bug #50158 (FILTER_VALIDATE_EMAIL fails with valid addresses containing = or ?).
(Patch by Pierrick)
-rw-r--r-- | NEWS | 2 | ||||
-rw-r--r-- | ext/filter/logical_filters.c | 2 | ||||
-rw-r--r-- | ext/filter/tests/bug50158.phpt | 19 |
3 files changed, 22 insertions, 1 deletions
@@ -2,6 +2,8 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? Nov 2009, PHP 5.2.12RC2 - Fixed bug #50174 (Incorrectly matched docComment). (Felipe) +- Fixed bug #50158 (FILTER_VALIDATE_EMAIL fails with valid addresses + containing = or ?). (Pierrick) - Fixed bug #49521 (PDO fetchObject sets values before calling constructor). (Pierrick) diff --git a/ext/filter/logical_filters.c b/ext/filter/logical_filters.c index bf3eaff107..2b72de1c2c 100644 --- a/ext/filter/logical_filters.c +++ b/ext/filter/logical_filters.c @@ -472,7 +472,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]+\\\")|([A-Za-z0-9_][A-Za-z0-9_\\!\\#\\$\\%\\&\\'\\*\\+\\-\\~\\/\\^\\`\\|\\{\\}]*(\\.[A-Za-z0-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]))\\.((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-z0-9\\-]))?)+[A-Za-z]+))$/D"; + const char regexp[] = "/^((\\\"[^\\\"\\f\\n\\r\\t\\b]+\\\")|([A-Za-z0-9_][A-Za-z0-9_\\!\\#\\$\\%\\&\\'\\*\\+\\-\\~\\/\\=\\?\\^\\`\\|\\{\\}]*(\\.[A-Za-z0-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]))\\.((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-z0-9\\-]))?)+[A-Za-z]+))$/D"; pcre *re = NULL; pcre_extra *pcre_extra = NULL; diff --git a/ext/filter/tests/bug50158.phpt b/ext/filter/tests/bug50158.phpt new file mode 100644 index 0000000000..4545cb06b0 --- /dev/null +++ b/ext/filter/tests/bug50158.phpt @@ -0,0 +1,19 @@ +--TEST-- +Bug #50158 (FILTER_VALIDATE_EMAIL fails with valid addresses containing = or ?) +--FILE-- +<?php + +$email_address = "test=mail@example.com"; +var_dump(filter_var($email_address, FILTER_VALIDATE_EMAIL)); + +$email_address = "test-mail@example.com"; +var_dump(filter_var($email_address, FILTER_VALIDATE_EMAIL)); + +$email_address = "test+mail@example.com"; +var_dump(filter_var($email_address, FILTER_VALIDATE_EMAIL)); + +?> +--EXPECTF-- +%unicode|string%(21) "test=mail@example.com" +%unicode|string%(21) "test-mail@example.com" +%unicode|string%(21) "test+mail@example.com" |