On install if there happens to be a webform component that has a key longer than 66 characters the installation of webform features will fail.

Example Error

PDOException: SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'machine_name' at row 1: UPDATE {webform_component} SET machine_name=:db_update_placeholder_0 WHERE (cid = :db_condition_placeholder_0) AND (nid = :db_condition_placeholder_1) ; Array ( [:db_update_placeholder_0] => really-really-really-really-really-really-really-really-really-really-really-really-really-long-form-key [:db_condition_placeholder_0] => 27 [:db_condition_placeholder_1] => 1515 ) in webform_features_install() (line 120 of sites/all/modules/contrib/webform_features/webform_features.install)

Since the form_key in the webform_component column is already set to a limit of 128 I see no reason why the machine_name column shouldn't match this limit.

Comments

kepford created an issue. See original summary.

kepford’s picture

This patch makes the requested change to the install function.

kepford’s picture

Status: Active » Needs review
damienmckenna’s picture

Status: Needs review » Reviewed & tested by the community

Seems reasonable, but is there an undocumented reason for this?

  • miteshmap committed 66a6b09 on 7.x-4.x authored by kepford
    Issue #2573489 by kepford: On install machine_name column in...
miteshmap’s picture

Version: 7.x-4.0-unstable1 » 7.x-4.x-dev
Status: Reviewed & tested by the community » Fixed

Seems reasonable :) applying patch.

  • miteshmap committed 9ab3e94 on 7.x-4.x
    Revert "Issue #2573489 by kepford: On install machine_name column in...
miteshmap’s picture

Status: Fixed » Needs work

Patch reverted. Found error It's "'length' = 128" instead of " => "

miteshmap’s picture

Status: Needs work » Needs review
StatusFileSize
new506 bytes

New patch created.

miteshmap’s picture

Status: Needs review » Fixed

  • miteshmap committed b7c8ca7 on 7.x-4.x
    Issue #2573489 by kepford, miteshmap: On install machine_name column in...

Status: Fixed » Closed (fixed)

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

jweowu’s picture

This fix is insufficient -- the form key is concatenated to the webform's machine name, so the machine name limit must be greater. As the webform machine name may be generated from the node title, and titles are varchar(255), some truncation is needed.

I've raised #2687447: Generated machine names can exceed length limits to increase the lengths of both types of machine name, and restrict the generated values to those maximums.