Closed (duplicate)
Project:
Drupal core
Version:
7.x-dev
Component:
user.module
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
22 May 2009 at 16:56 UTC
Updated:
19 Dec 2009 at 18:40 UTC
Jump to comment: Most recent file
Comments
Comment #1
grendzy commentedComment #2
brianV commentedConfirmed.
We should attempt to comply to the RFC. At the same time, text fields are slow compared to varchars, so perhaps just increasing this to 255 is a good start.
Comment #3
damien tournoud commentedIt makes complete sense to bump that to 255 characters.
Comment #4
brianV commentedAttached is a patch to bump the email field to 255 characters.
Are we not too concerned about complying to the RFC? It would make the DB slower sorting TEXT fields, but at the same time, standards-compliance is a good thing.
Comment #5
brianV commentedComment #6
damien tournoud commentedThere is a big difference between a "standard compliant email address" and a "email that a website should accept as valid". For example,
"Damien Tournoud"@[2001:0db8:85a3:08d3:1319:8a2e:0370:7334]is a standard compliant email address, but probably one any decent website should not accept as valid.In the current case, I don't see any real person having an email address longer then 255 characters (not even 64 characters for that matter). So yes we can bump to 255 characters, because the 64 character limit seems arbitrary low, but going over 255 characters does no make a lot of sense.
Comment #7
grendzy commentedCool! I assume it will also need an upgrade path for 6.x.
I did a little research, and we might be able to get away with varchar(320) with no performance penalty vs. 255 chars.
MySQL 5.0.3 supports varchars longer that 255, as does Postgres and Sqlite. Also MySQL 5.0 is a requirement now anyway: #220329: Up minimum MySQL version to 5.0
In practical terms I'm sure that 255 is "big enough"... I mean 64 must be adequate or we would have seen this issue sooner. IMHO though if it's worth bothering with at all, it's worth trying to meet the spec, if we can do so without adversely affecting performance.
Comment #8
brianV commentedThere is no upgrade path needed - the old, short email addresses will work fine in the new, longer field.
Also, if varchars longer than 255 are only available in MySQL 5.0.3, then they still violate the posted minimum requirements of MySQL 5.0. Either we would have to bump the minimum requirements, or just stick with 255.
Comment #9
grendzy commentedWouldn't it need a
? Or does the schema API somehow know how to handle this?
I'll do a bit of research to see if bumping the version requirement to 5.0.3 makes sense... I don't think it matters much for this issue in particular, but it seems bigger varchars would open other doors.
Comment #10
brianV commentedAh, for some reason, I thought the database was already set to use 255 chars.
Patch attached with a schema update.
Comment #11
lilou commentedYou need change also
user_schema()in user.install :Comment #12
lilou commentedhttp://dev.mysql.com/doc/refman/5.0/en/char.html :
Comment #13
brianV commentedOops, my bad! Fixed...
@lilou, that change won't work with the current minimum requirements of MySQL 5.0, since a user may have a version < 5.0.3, so we would have to change the system requirements, which would be difficult to justify for such a trivia feature.
Also, can you guarantee that Postgres and sqlite support this feature as well?
Comment #14
lilou commentedPatch looks good, and RTBC when testbot is repair.
Comment #16
Herman Hiddema commentedActually, spec is that the email address can be at most 254 characters long, not 320.
RFC5321 (SMTP) section 4.5.3.1.3 restricts the path element to 256 chars, including opening and closing angled brackets.
See also:
http://www.eph.co.uk/resources/email-address-length-faq/
Comment #17
damien tournoud commentedWho cares? Let's bump that to 255.
Comment #18
jerryjvl commentedNote that the article (See also: http://www.eph.co.uk/resources/email-address-length-faq/) actually references this bug, and makes a solid argued case that '254' is the correct value to support.
Comment #19
Herman Hiddema commentedAlthough I have little doubt that most SMTP implementations are resilient enough to handle overlong forward-path entries, it is still bad form for Drupal to overflow it. If 254 is the standard, why not simply go with 254? It fits the older (MySQL pre 5.0.3) varchar implementation, and is sure not to overflow SMTP.
Comment #20
brianV commentedI feel inclined to support the 254-character argument supported by the article posted before:
I've checked, and the errata for RFC3696 indeed specifies that the maximum length of an email address that can be sent is 256 characters, including the brackets:
Unless there are other well-reasoned objections, I intend to adjust my patch above to 254 chars, as it both matches the specified minimum requirements for D7 (MySQL 5.0) and, via reasonable argument, complies with the RFC.
Comment #21
grendzy commentedBrianV, I would say yes, go for it.
Comment #22
brianV commentedNew patch attached with 254-character email column.
Comment #24
grendzy commented-- Comment should say 254, not 255
-- missing space after 'length' => 254,
-- db_change_field fails when $ret is one of the parameters, is the API doc wrong on this one?
-- db_change_field loses the COMMENT when 'description' isn't given (is this a bug in db_change_field?)
Comment #25
lilou commentedFollow here : #502968: Increase maximum allowable length of email addresses
Comment #26
Ryan Palmer commentedMy apologies.. mine was actually a duplicate of yours.