Problem/Motivation

The name of the Ticket entity is set to a max length of 50. However it does not check if the calculated name based on the product title, throwing an SQL error for the user.

Steps to reproduce

Create a product with a name longer than 43 (50 - strlen("Ticket")).

Attempt to purchase with ticket to be created.

Enjoy: Drupal\Core\Entity\EntityStorageException: SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'name' at row 1:

Proposed resolution

See attached patch. Alternatively or as well could increase the length of the name field.

CommentFileSizeAuthor
#2 3218870-ticket-name-length.patch778 bytesmaxwellkeeble

Comments

maxwellkeeble created an issue. See original summary.

maxwellkeeble’s picture

StatusFileSize
new778 bytes

Attached patch.

pcambra’s picture

Issue tags: +v1.1

We should maybe review why the error happens in terms of the data definition

pcambra’s picture

Status: Active » Needs work
pcambra’s picture

Issue tags: -v1.1 +2.x
pcambra’s picture

Version: 1.0.2 » 2.x-dev
Issue tags: -2.x

  • maxwellkeeble authored 202ce6e on 2.x
    Issue #3218870 by maxwellkeeble: Can't create tickets with product title...
  • pcambra authored 30e349d on 2.x
    Issue #3218870 by pcambra: Tests for tickets with product title longer...
pcambra’s picture

Version: 2.x-dev » 1.x-dev
Status: Needs work » Needs review

  • maxwellkeeble authored bcec88f on 1.x
    Issue #3218870 by maxwellkeeble: Can't create tickets with product title...
pcambra’s picture

Status: Needs review » Fixed

Many thanks for your contribution @maxwellkeeble! I've pushed this as it is for 1.x and added it with tests for 2.x

Status: Fixed » Closed (fixed)

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