Hi, I got this error message when I click save to add a new newsletter category.

PDOException: SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'from_name' at row 1: INSERT INTO {simplenews_category} (tid, format, priority, receipt, from_name, from_address, email_subject, hyperlinks, new_account, opt_inout, block) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8, :db_insert_placeholder_9, :db_insert_placeholder_10); Array ( [:db_insert_placeholder_0] => 84 [:db_insert_placeholder_1] => plain [:db_insert_placeholder_2] => 0 [:db_insert_placeholder_3] => 0 [:db_insert_placeholder_4] => my site name [:db_insert_placeholder_5] => my email address [:db_insert_placeholder_6] => [[simplenews-category:name]] [node:title] [:db_insert_placeholder_7] => 1 [:db_insert_placeholder_8] => none [:db_insert_placeholder_9] => double [:db_insert_placeholder_10] => 1 ) in simplenews_category_save() (line 1903 of sites\all\modules\simplenews\simplenews.module).

CommentFileSizeAuthor
#2 decrease_maxlength.patch864 bytesBerdir
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Berdir’s picture

Title: Probelm in adding a new newsletter category » Missing length validation on from_name

Looks like your From name is too long, so we either need to increase the field in the database and/or add a max length validation to it.

Berdir’s picture

Version: 7.x-1.0-beta2 » 7.x-1.x-dev
Status: Active » Needs review
FileSize
864 bytes

The attached patch adjusts the length of the from_name to that of the database column.

DrupalDan’s picture

Hi Berdir,

Thank you for your quick response. Actually the name is pretty concise, something like "Company Corporate Mailing List".

Also, I got another bug all over my site yesterday and it disappeared once I uninstalled the module. Thank you for the patch; I'll reinstall the module and patch it and let you know if there's any problem. Thanks again!

Berdir’s picture

Status: Needs review » Fixed

Commited.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.