felipe                                   Sun, 15 Nov 2009 16:53:40 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=290791

Log:
- Fixed bug #50158 (FILTER_VALIDATE_EMAIL fails with valid addresses containing 
= or ?).
  (Patch by Pierrick)

Bug: http://bugs.php.net/50158 (Verified) FILTER_VALIDATE_EMAIL fails with 
valid addresses containing = or ?
      
Changed paths:
    U   php/php-src/branches/PHP_5_2/NEWS
    U   php/php-src/branches/PHP_5_2/ext/filter/logical_filters.c
    A   php/php-src/branches/PHP_5_2/ext/filter/tests/bug50158.phpt
    U   php/php-src/branches/PHP_5_3/NEWS
    U   php/php-src/branches/PHP_5_3/ext/filter/logical_filters.c
    A   php/php-src/branches/PHP_5_3/ext/filter/tests/bug50158.phpt
    U   php/php-src/trunk/ext/filter/logical_filters.c
    A   php/php-src/trunk/ext/filter/tests/bug50158.phpt

Modified: php/php-src/branches/PHP_5_2/NEWS
===================================================================
--- php/php-src/branches/PHP_5_2/NEWS	2009-11-15 16:27:03 UTC (rev 290790)
+++ php/php-src/branches/PHP_5_2/NEWS	2009-11-15 16:53:40 UTC (rev 290791)
@@ -2,6 +2,8 @@
 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
 ?? 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)


Modified: php/php-src/branches/PHP_5_2/ext/filter/logical_filters.c
===================================================================
--- php/php-src/branches/PHP_5_2/ext/filter/logical_filters.c	2009-11-15 16:27:03 UTC (rev 290790)
+++ php/php-src/branches/PHP_5_2/ext/filter/logical_filters.c	2009-11-15 16:53:40 UTC (rev 290791)
@@ -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_\\!\\#\\$\\%\\&\\'\\*\\+\\-\\~\\/\\^\\`\\|\\{\\}]*(\\.[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;

Added: php/php-src/branches/PHP_5_2/ext/filter/tests/bug50158.phpt
===================================================================
--- php/php-src/branches/PHP_5_2/ext/filter/tests/bug50158.phpt	                        (rev 0)
+++ php/php-src/branches/PHP_5_2/ext/filter/tests/bug50158.phpt	2009-11-15 16:53:40 UTC (rev 290791)
@@ -0,0 +1,19 @@
+--TEST--
+Bug #50158 (FILTER_VALIDATE_EMAIL fails with valid addresses containing = or ?)
+--FILE--
+<?php
+
+$email_address = "test=m...@example.com";
+var_dump(filter_var($email_address, FILTER_VALIDATE_EMAIL));
+
+$email_address = "test-m...@example.com";
+var_dump(filter_var($email_address, FILTER_VALIDATE_EMAIL));
+
+$email_address = "test+m...@example.com";
+var_dump(filter_var($email_address, FILTER_VALIDATE_EMAIL));
+
+?>
+--EXPECTF--
+%unicode|string%(21) "test=m...@example.com"
+%unicode|string%(21) "test-m...@example.com"
+%unicode|string%(21) "test+m...@example.com"


Property changes on: php/php-src/branches/PHP_5_2/ext/filter/tests/bug50158.phpt
___________________________________________________________________
Added: svn:keywords
   + Id Rev Revision
Added: svn:eol-style
   + native

Modified: php/php-src/branches/PHP_5_3/NEWS
===================================================================
--- php/php-src/branches/PHP_5_3/NEWS	2009-11-15 16:27:03 UTC (rev 290790)
+++ php/php-src/branches/PHP_5_3/NEWS	2009-11-15 16:53:40 UTC (rev 290791)
@@ -21,6 +21,8 @@
   (Pierre)

 - Fixed bug #50174 (Incorrectly matched docComment). (Felipe)
+- Fixed bug #50158 (FILTER_VALIDATE_EMAIL fails with valid addresses
+  containing = or ?). (Pierrick)
 - Fixed bug #50087 (NSAPI performance improvements). (Uwe Schindler)
 - Fixed bug #50152 (ReflectionClass::hasProperty behaves like isset() not
   property_exists). (Felipe)

Modified: php/php-src/branches/PHP_5_3/ext/filter/logical_filters.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/filter/logical_filters.c	2009-11-15 16:27:03 UTC (rev 290790)
+++ php/php-src/branches/PHP_5_3/ext/filter/logical_filters.c	2009-11-15 16:53:40 UTC (rev 290791)
@@ -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_\\!\\#\\$\\%\\&\\'\\*\\+\\-\\~\\/\\^\\`\\|\\{\\}]*(\\.[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;

Added: php/php-src/branches/PHP_5_3/ext/filter/tests/bug50158.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/filter/tests/bug50158.phpt	                        (rev 0)
+++ php/php-src/branches/PHP_5_3/ext/filter/tests/bug50158.phpt	2009-11-15 16:53:40 UTC (rev 290791)
@@ -0,0 +1,19 @@
+--TEST--
+Bug #50158 (FILTER_VALIDATE_EMAIL fails with valid addresses containing = or ?)
+--FILE--
+<?php
+
+$email_address = "test=m...@example.com";
+var_dump(filter_var($email_address, FILTER_VALIDATE_EMAIL));
+
+$email_address = "test-m...@example.com";
+var_dump(filter_var($email_address, FILTER_VALIDATE_EMAIL));
+
+$email_address = "test+m...@example.com";
+var_dump(filter_var($email_address, FILTER_VALIDATE_EMAIL));
+
+?>
+--EXPECTF--
+%unicode|string%(21) "test=m...@example.com"
+%unicode|string%(21) "test-m...@example.com"
+%unicode|string%(21) "test+m...@example.com"


Property changes on: php/php-src/branches/PHP_5_3/ext/filter/tests/bug50158.phpt
___________________________________________________________________
Added: svn:keywords
   + Id Rev Revision
Added: svn:eol-style
   + native

Modified: php/php-src/trunk/ext/filter/logical_filters.c
===================================================================
--- php/php-src/trunk/ext/filter/logical_filters.c	2009-11-15 16:27:03 UTC (rev 290790)
+++ php/php-src/trunk/ext/filter/logical_filters.c	2009-11-15 16:53:40 UTC (rev 290791)
@@ -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_\\!\\#\\$\\%\\&\\'\\*\\+\\-\\~\\/\\^\\`\\|\\{\\}]*(\\.[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;

Added: php/php-src/trunk/ext/filter/tests/bug50158.phpt
===================================================================
--- php/php-src/trunk/ext/filter/tests/bug50158.phpt	                        (rev 0)
+++ php/php-src/trunk/ext/filter/tests/bug50158.phpt	2009-11-15 16:53:40 UTC (rev 290791)
@@ -0,0 +1,19 @@
+--TEST--
+Bug #50158 (FILTER_VALIDATE_EMAIL fails with valid addresses containing = or ?)
+--FILE--
+<?php
+
+$email_address = "test=m...@example.com";
+var_dump(filter_var($email_address, FILTER_VALIDATE_EMAIL));
+
+$email_address = "test-m...@example.com";
+var_dump(filter_var($email_address, FILTER_VALIDATE_EMAIL));
+
+$email_address = "test+m...@example.com";
+var_dump(filter_var($email_address, FILTER_VALIDATE_EMAIL));
+
+?>
+--EXPECTF--
+%unicode|string%(21) "test=m...@example.com"
+%unicode|string%(21) "test-m...@example.com"
+%unicode|string%(21) "test+m...@example.com"


Property changes on: php/php-src/trunk/ext/filter/tests/bug50158.phpt
___________________________________________________________________
Added: svn:keywords
   + Id Rev Revision
Added: svn:eol-style
   + native
-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to