Bug #69581 [Nab]: filter_var() FILTER_VALIDATE_EMAIL, E-Mail length

From: Date: Fri, 08 May 2015 07:23:04 +0000
Subject: Bug #69581 [Nab]: filter_var() FILTER_VALIDATE_EMAIL, E-Mail length
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-192574@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=69581&edit=1 ID: 69581 Updated by: rasmus@php.net Reported by: sebastian at dmwd dot de Summary: filter_var() FILTER_VALIDATE_EMAIL, E-Mail length Status: Not a bug Type: Bug Package: Filter related Operating System: Linux PHP Version: 5.6.8 Block user comment: N Private report: N New Comment: The 64 octets limit for the local part is pretty well-known and it is implemented in many smtp servers. I think it would be a really bad idea for us to state that an address with a local part larger than 64 is perfectly valid and then have it not actually work when people try to send mail with it. A quick web search reveals: https://kc.mcafee.com/corporate/index?page=content&id=KB56459 That is some random McAfee email server appliance which clearly has a default limit of 64 for the local part. You have to manually go in and override it to make it accept longer addresses. And another one: http://esupport.trendmicro.com/Pages/Syntax-error-SMTP-Error-Code-501-occurs-when-receiving-mails-with-very.aspx And another: http://www-01.ibm.com/support/knowledgecenter/SSLTBW_2.1.0/com.ibm.zos.v2r1.halu001/smtpcommands.htm Previous Comments: ------------------------------------------------------------------------ [2015-05-08 06:30:50] yohgaki@php.net I agree to have RFC compliance in general. However, most mail system allows "username part == max file name length". It's 255 bytes or so usually. 64 octets limit seems a bit too severe to me. Perhaps, double the limit for user names? There may be system generated long user names for some purposes. 64 bytes would be long enough for almost all user names, though. ------------------------------------------------------------------------ [2015-05-08 06:12:51] rasmus@php.net RFC 5322 section 4.5.3.1.1 states: The maximum total length of a user name or other local-part is 64 octets. This address is therefore invalid according to the strict interpretation of the RFC ------------------------------------------------------------------------ [2015-05-06 11:50:34] cmb@php.net Apparently, the behavior has changed as of PHP 5.2.14/5.3.3: <http://3v4l.org/7iHni> ------------------------------------------------------------------------ [2015-05-06 06:04:20] sebastian at dmwd dot de Description: ------------ Validation of long e-mail addresses with filter_var and FILTER_VALIDATE_EMAIL fails. Test script: --------------- var_dump(filter_var('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa@foo.com', FILTER_VALIDATE_EMAIL)); Expected result: ---------------- string(78) "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa@foo.com" Actual result: -------------- bool(false) ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=69581&edit=1

« previous php.bugs (#192574) next »