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
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
43 - 24 = ?
Subscribe to this entry?

 
 [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-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 03:01:29 2024 UTC