Req #16906 [Asn]: no email validation like HTML_QuickForm_Rule_Email

From: Date: Tue, 20 Mar 2012 16:26:19 +0000
Subject: Req #16906 [Asn]: no email validation like HTML_QuickForm_Rule_Email
References: 1  Groups: php.pear.bugs 
Request: Send a blank email to pear-bugs+get-8416@lists.php.net to get a copy of this message
Edit report at https://pear.php.net/bugs/bug.php?id=16906&edit=1 ID: 16906 Updated by: borz_off@cs.msu.su Reported By: hm2k at php dot net -Summary: no email validation like HTML_Qu +Summary: no email validation like HTML_QuickForm_Rule_Email Status: Assigned Type: Feature/Change Request Package: HTML_QuickForm2 Package Version: 0.3.0 PHP Version: Irrelevant Assigned To: mansion Roadmap Versions: New Comment: -Summary: no email validation like HTML_Qu +Summary: no email validation like HTML_QuickForm_Rule_Email Email rule is available in 2.0.0beta1 However it is quite basic and needs a few knobs added to configure its behaviour. Previous Comments: ------------------------------------------------------------------------ [2011-11-21 08:53:01] mansion -Assigned To: +Assigned To: mansion ------------------------------------------------------------------------ [2010-07-09 16:45:22] hm2k My advise would be to impliment it from HTML_QuickForm and improve. Implementing filter_var, while better than nothing isn't exactly ideal. ------------------------------------------------------------------------ [2010-07-09 15:08:37] cweiske While the filter_var rule is a good idea itself, is it not something I would advise people to use for validating email addresses with QF2 - it's a common task that requires an own rule IMO. ------------------------------------------------------------------------ [2010-07-09 11:02:27] hm2k I wrote a whole essay on this matter: http://www.hm2k.com/posts/what-is-a-valid-email-address It pretty much addresses my concerns here. ------------------------------------------------------------------------ [2010-07-09 10:30:17] mansion We could also add a new rule simply called 'filter_var' or 'filter' that would in turn call the function filter_var() with given parameters ? It would make things easier than using the callback rule. The filter extension is apparently enabled by default since PHP 5.2, which is our minimum version for using QF2 so it should be ok. The filter_var email regex is a bit difficult to read and will validate addresses with IPv4 or IPv6 in place of domain names which might not always be what you expect. At the moment, I use this regex instead : "/^[_+a-z0-9-]+(\.[_+a-z0-9-']+)*@[a-z0-9-]+(\.[a-z0-9-]{1,})*\.([a- z]{2,}){1}$/" It's not perfect but it fits my needs. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://pear.php.net/bugs/bug.php?id=16906 -- Edit this bug report at https://pear.php.net/bugs/bug.php?id=16906&edit=1

« previous php.pear.bugs (#8416) next »