E-mail address validation problem + patch

2010-01-27 Thread Veres-Szentkiralyi Andras
Hi,
the e-mail address validator in CakePHP considers addresses in the form of 
f...@bar.com invalid because of the regular expression used for this purpose 
in cake/libs/validation.php. Although RFC 5322 specifies that the local-part 
of an e-mail address cannot end with a dot, some providers (e.g. freemail.hu, 
with 3 million mailboxes) allow users to get and use such e-mail addresses.

From a technical viewpoint I agree that such addresses shouldn't be allowed to 
be used, but saying go away, leave our beloved RFC alone to every user who 
visits a CakePHP-based webshop or other website is not a solution either.

I attached a patch, which fixes this particular problem, consider applying it.

-- 
Veres-Szentkirályi András

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
From 52c9e17a1ef837b6c850c7f61edc7ed37604692c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A1s=20Veres-Szentkir=C3=A1lyi?= v...@vsza.hu
Date: Wed, 27 Jan 2010 05:02:27 +0100
Subject: [PATCH] Fixing the e-mail validation regexp (f...@bar.com)

---
 cake/libs/validation.php |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/cake/libs/validation.php b/cake/libs/validation.php
index 20324dd..4a887a8 100644
--- a/cake/libs/validation.php
+++ b/cake/libs/validation.php
@@ -387,7 +387,7 @@ class Validation extends Object {
 		}
 
 		if (is_null($regex)) {
-			$regex = '/^[a-z0-9!#$%\'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%\'*+\/=?^_`{|}~-]+)*@' . self::$__pattern['hostname'] . '$/i';
+			$regex = '/^[\.a-z0-9!#$%\'*+\/=?^_`{|}~-]+@' . self::$__pattern['hostname'] . '$/i';
 		}
 		$return = self::_check($check, $regex);
 		if ($deep === false || $deep === null) {
-- 
1.6.5



Re: E-mail address validation problem + patch

2010-01-27 Thread BrendonKoz
Thank you for your work, Veres-Szentkiralya Andras.  Although I do not
work with the Cake team, I do know that sending this to the Google
Group isn't the proper place to submit change requests, and may go
unseen by the developers.

To submit bug reports/patches/fixes, you would want to use their
current ticket/repository system located (I believe) at Lighthouse:
http://cakephp.lighthouseapp.com/home

On Jan 26, 11:31 pm, Veres-Szentkiralyi Andras v...@vsza.hu wrote:
 Hi,
 the e-mail address validator in CakePHP considers addresses in the form of
 f...@bar.com invalid because of the regular expression used for this purpose
 in cake/libs/validation.php. Although RFC 5322 specifies that the local-part
 of an e-mail address cannot end with a dot, some providers (e.g. freemail.hu,
 with 3 million mailboxes) allow users to get and use such e-mail addresses.

 From a technical viewpoint I agree that such addresses shouldn't be allowed to
 be used, but saying go away, leave our beloved RFC alone to every user who
 visits a CakePHP-based webshop or other website is not a solution either.

 I attached a patch, which fixes this particular problem, consider applying it.

 --
 Veres-Szentkirályi András

  0001-Fixing-the-e-mail-validation-regexp-foo.-bar.com.patch
  1KViewDownload

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en