php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #65558 FILTER_VALIDATE_EMAIL doesn't invalidate email with double quote as local part.
Submitted: 2013-08-26 10:11 UTC Modified: 2013-08-27 17:42 UTC
From: fleshgrinder at gmx dot at Assigned:
Status: Not a bug Package: filter (PECL)
PHP Version: 5.5.3 OS: Debian 7.0
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: fleshgrinder at gmx dot at
New email:
PHP Version: OS:

 

 [2013-08-26 10:11 UTC] fleshgrinder at gmx dot at
Description:
------------
The local part of the email address is empty and the address should not validate at all.

Quote from RFC 5322 section 3.4.1 about double quote usage:

quoted-string = [CFWS] DQUOTE *([FWS] qcontent) [FWS] DQUOTE [CFWS] qcontent = qtext / quoted-pair qtext = %d33 / ; Printable US-ASCII %d35-91 / ; characters not including %d93-126 / ; "\" or the quote character obs-qtext quoted-pair = ("\" (VCHAR / WSP)) / obs-qp

Quote from RFC 5322 section 3.4.1 about local-part:

local-part = dot-atom / quoted-string / obs-local-part dot-atom = [CFWS] dot-atom-text [CFWS] dot-atom-text = 1*atext *("." 1*atext) quoted-string = [CFWS] DQUOTE *([FWS] qcontent) [FWS] DQUOTE [CFWS] obs-local-part = word *("." word) word = atom / quoted-string atom = [CFWS] 1*atext [CFWS]

Test script:
---------------
var_dump(filter_var('""@php.net', FILTER_VALIDATE_EMAIL));

Expected result:
----------------
bool(false)

Actual result:
--------------
string(""@php.net)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-08-27 11:20 UTC] cmbecker69 at gmx dot de
The behavior is in accordance with RFC 5322.

|  quoted-string = [CFWS]
|                  DQUOTE *([FWS] qcontent) [FWS] DQUOTE
|                  [CFWS]

All parts except the two DQUOTEs are optional (see RFC 5234, 
especially section 3.6[1]), so the local part of an email address 
may consist of two quotes only.

[1] <http://tools.ietf.org/html/rfc5234#section-3.6>
 [2013-08-27 11:41 UTC] fleshgrinder at gmx dot at
-Status: Open +Status: Closed
 [2013-08-27 11:41 UTC] fleshgrinder at gmx dot at
After reading things more closely, you are right. Sorry for the report.
 [2013-08-27 17:42 UTC] rasmus@php.net
-Status: Closed +Status: Not a bug
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Thu Dec 09 05:03:34 2021 UTC