Can't save a template if I used long label

Created on 7 March 2023, over 1 year ago
Updated 24 August 2023, 10 months ago

Problem/Motivation

I faced an issue we I tried to create a template and used a long label (> 50 characters).

Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'label' at row 1: INSERT INTO "section_library_template" ("uuid", "langcode", "user_id", "label", "type", "entity_id", "entity_type", "image__target_id", "image__display", "image__description", "created", "changed") 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, :db_insert_placeholder_11); Array
(
    [:db_insert_placeholder_0] => 50d6c8cf-860e-4b55-b282-2b799737f554
    [:db_insert_placeholder_1] => en
    [:db_insert_placeholder_2] => 1
    [:db_insert_placeholder_3] => Lorem ipsum dolor sit amet consectetur adipiscing elitrwt
    [:db_insert_placeholder_4] => template
    [:db_insert_placeholder_5] => 1387
    [:db_insert_placeholder_6] => node
    [:db_insert_placeholder_7] => 
    [:db_insert_placeholder_8] => 
    [:db_insert_placeholder_9] => 
    [:db_insert_placeholder_10] => 1678180683
    [:db_insert_placeholder_11] => 1678180683
)

Steps to reproduce

Proposed resolution

I suggest increasing the max length of the label field to 255.

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Needs review

Version

1.0

Component

Code

Created by

πŸ‡―πŸ‡΄Jordan Odai Atieh Amman

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • Issue created by @Odai Atieh
  • Status changed to Needs review over 1 year ago
  • πŸ‡―πŸ‡΄Jordan Odai Atieh Amman
  • First commit to issue fork.
  • Open on Drupal.org β†’
    Core: 10.0.7 + Environment: PHP 8.1 & MySQL 8
    last update 12 months ago
    Waiting for branch to pass
  • @matthijs opened merge request.
  • πŸ‡§πŸ‡ͺBelgium Matthijs

    The PR changes the maxlength of the label textfield to 50 instead of altering the field definition like the patch does.
    I've hidden the patch because it deletes all existing entities during the update hook, which looks dangerous to me.

  • Open on Drupal.org β†’
    Core: 10.0.7 + Environment: PHP 8.1 & MySQL 8
    last update 10 months ago
    Waiting for branch to pass
  • πŸ‡§πŸ‡ͺBelgium weseze

    It's probably much easier to just change the allowed length on the label fields, rather then changing the schema and existing field.
    See attached patch.

  • πŸ‡§πŸ‡ͺBelgium Matthijs

    @weseze: maybe update the merge request as well with your change to AddSectionToLibraryForm.

Production build 0.69.0 2024