iliaa           Tue Jul  7 00:44:20 2009 UTC

  Modified files:              (Branch: PHP_5_3)
    /php-src/ext/filter logical_filters.c 
    /php-src/ext/filter/tests   016.phpt 
  Log:
  
  MFB: Fixed bug #48808 (FILTER_VALIDATE_EMAIL allows some invalid e-mail
  syntaxes)
  
http://cvs.php.net/viewvc.cgi/php-src/ext/filter/logical_filters.c?r1=1.1.2.22.2.13&r2=1.1.2.22.2.14&diff_format=u
Index: php-src/ext/filter/logical_filters.c
diff -u php-src/ext/filter/logical_filters.c:1.1.2.22.2.13 
php-src/ext/filter/logical_filters.c:1.1.2.22.2.14
--- php-src/ext/filter/logical_filters.c:1.1.2.22.2.13  Sun Jul  5 16:08:05 2009
+++ php-src/ext/filter/logical_filters.c        Tue Jul  7 00:44:20 2009
@@ -17,7 +17,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: logical_filters.c,v 1.1.2.22.2.13 2009/07/05 16:08:05 iliaa Exp $ */
+/* $Id: logical_filters.c,v 1.1.2.22.2.14 2009/07/07 00:44:20 iliaa Exp $ */
 
 #include "php_filter.h"
 #include "filter_private.h"
@@ -472,7 +472,7 @@
 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_\\!\\#\\$\\%\\&\\'\\*\\+\\-\\~\\/\\^\\`\\|\\{\\}]*)*))@((\\[(((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;
http://cvs.php.net/viewvc.cgi/php-src/ext/filter/tests/016.phpt?r1=1.4.2.4.2.2&r2=1.4.2.4.2.3&diff_format=u
Index: php-src/ext/filter/tests/016.phpt
diff -u php-src/ext/filter/tests/016.phpt:1.4.2.4.2.2 
php-src/ext/filter/tests/016.phpt:1.4.2.4.2.3
--- php-src/ext/filter/tests/016.phpt:1.4.2.4.2.2       Sun Jul  5 16:08:05 2009
+++ php-src/ext/filter/tests/016.phpt   Tue Jul  7 00:44:20 2009
@@ -15,7 +15,11 @@
 '[]()/@example.com',   
 'qwertyuiopasdfghjklzxcv...@qwertyuiopasdfghjklzxcvbnm.net',
 'e.x.a.m.p.l...@example.com',
-'firstname.lastn...@employee.2something.com'
+'firstname.lastn...@employee.2something.com',
+'-...@foo.com',
+'f...@-.com',
+'f...@bar.123',
+'f...@bar.-'
 );
 foreach ($values as $value) {
        var_dump(filter_var($value, FILTER_VALIDATE_EMAIL));
@@ -35,4 +39,8 @@
 string(57) "qwertyuiopasdfghjklzxcv...@qwertyuiopasdfghjklzxcvbnm.net"
 string(26) "e.x.a.m.p.l...@example.com"
 string(42) "firstname.lastn...@employee.2something.com"
-Done
\ No newline at end of file
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+Done



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to