Closed (fixed)
Project:
Feeds Comment Processor
Version:
7.x-1.x-dev
Component:
Code
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
29 Jun 2012 at 10:16 UTC
Updated:
3 Oct 2013 at 10:43 UTC
The module does not seem to check the length of the subject line. This is a problem, because the subject column in the database only supports strings of 64 characters and thus, Drupal throws an error when importing mails via e-mail.
SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'subject' at row 1
comment_save does a trim, but only when the subject is not set.
The patch fixes this.
| Comment | File | Size | Author |
|---|---|---|---|
| trim-subject-line.patch | 742 bytes | BarisW |
Comments
Comment #1
BarisW commentedComment #2
Yuri commentedYes, I confirm that the error is now gone, when that patch is applied.
Comment #3
danepowell commentedI don't know how the original patch ever worked- it uses the non-existent variable $comment_text. It also clobbers the subject if it already exists.
I committed a variation of this:
http://drupalcode.org/project/feeds_comment_processor.git/commit/503da5d
Comment #5
rob230 commentedSorry if this is a stupid question, but why have you chosen 29 as the truncation length? The subject field of comments has a limit of 64 characters. If I update to the latest version that has this commit, will my comments' subjects be limited to 29 characters?
Comment #6
danepowell commented@BarisW would have to answer why 29 is the magic number. I didn't really think about it- I just adapted his patch. You might want to open a new issue if your subjects are being truncated.
Comment #7
BarisW commentedThe subject column can contain 32 characters. As we append three dots I chose to limit the length to 29 (+3 = 32).
Comment #8
rob230 commentedIf you look at comment_schema(), the subject field is 64 characters:
Also in the database:
You also said 64 in the original post. I'm not sure where 32 has come from?
I have tried limiting it to 64 and it worked fine. 32 seems a bit short to me:
1234567890123456789012
Of course, it will work because 32 is less than 64 but you are limiting people unnecessarily to half of what they could have.
Comment #9
rob230 commentedAlso I think truncate_utf8() handles the three dots for you and still keeps the length you specify.
Comment #10
danepowell commentedThanks for the investigating Rob230- could you please open a new issue for increasing the limit, and post a patch there if you're able?
Comment #11
rob230 commentedSure thing. Please see #2103707: Subject truncated incorrectly.