Bug->Req #71893 [Opn]: Email address with long (>64) local-part rejected by FILTER_VALIDATE_EMAIL

From: Date: Fri, 25 Mar 2016 01:45:34 +0000
Subject: Bug->Req #71893 [Opn]: Email address with long (>64) local-part rejected by FILTER_VALIDATE_EMAIL
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-200081@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=71893&edit=1 ID: 71893 Updated by: requinix@php.net Reported by: bfarber at invisiopower dot com -Summary: Valid email address rejected by FILTER_VAR +Summary: Email address with long (>64) local-part rejected by FILTER_VALIDATE_EMAIL Status: Open -Type: Bug +Type: Feature/Change Request Package: Filter related Operating System: CentOS / Windows -PHP Version: 5.5.33 +PHP Version: 7.0.4 Block user comment: N Private report: N New Comment: The email regex PHP uses [1] was written against RFC 2821, which imposes [2] a limit of 64 characters on the local part (stuff before the @). And while it was obsoleted by RFC 5321, the length limitation was unchanged [3]. Meanwhile the complementary RFC 5322 (which obsoleted 2822) uses "[a] liberal syntax" with no mention of a length limit, and does comment that "[t]he local-part portion is a domain-dependent string" [4]. The regex is behaving as expected but isn't quite flexible enough for your usage. [1] https://git.io/vapjB (/ext/filter/logical_filters.c line 601) [2] http://tools.ietf.org/html/rfc2821#section-4.5.3.1 [3] http://tools.ietf.org/html/rfc5321#section-4.5.3.1 [4] http://tools.ietf.org/html/rfc5322#section-3.4.1 Previous Comments: ------------------------------------------------------------------------ [2016-03-24 19:08:23] bfarber at invisiopower dot com Description: ------------ I have a valid email address that is being rejected by filter_var on two different servers. If this has already been addressed, I apologize in advance for the duplicate bug report. I've tested with 5.5.12 and 5.4.43 with the same results, and I don't have another environment loaded right now with a more recent version of PHP. That said, I looked through the changelog and no fixes stood out after 5.5.12 that would address this issue. The example email address is loop-300mcconvillerdlisti-Folder-b5d8dbce-201f-4fdb-be88-ea6b9a486736z55662107@upload.dotloop.com. This is an email provided by a newer service "DotLoop" but when we attempt to validate the email address on our end it fails. The email address is valid and has nothing out of the ordinary going on with it. I did note several past bugs related to dash symbols and/or multiple dash symbols in the email address, so that may be relevant here since the email address has multiple dash symbols. Test script: --------------- <?php $email = "loop-300mcconvillerdlisti-Folder-b5d8dbce-201f-4fdb-be88-ea6b9a486736z55662107@upload.dotloop.com"; var_dump( filter_var( $email, FILTER_VALIDATE_EMAIL ) ); Expected result: ---------------- filter_var should return the email address as provided Actual result: -------------- filter_var returns FALSE ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=71893&edit=1

« previous php.bugs (#200081) next »