If the referer value length is greater than 255 characters, The following error occurs

Drupal\Core\Entity\EntityStorageException: SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'referers_value' at row 1: INSERT INTO {broken_link__referers} (entity_id, revision_id, bundle, delta, langcode, referers_value)

I checked the base field definition of the referer field and the length in constraint is not working.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

hmdnawaz created an issue. See original summary.

hmdnawaz’s picture

hmdnawaz’s picture

Status: Active » Needs review
hmdnawaz’s picture

StatusFileSize
new975 bytes

The query_string base field also uses the wrong length. We need to set the max length of the field instead of adding a length constraints.

Here is the new patch.

jcandan’s picture

Ran into this error for the query_string base field after a Drupal core upgrade from 9.2.10 to 9.3.3. However, after upgrading to 9.2.11 I was not able to reproduce this error.

This seems like an arbitrary maximum. We tried bumping it to 20,000 (almost the 21,844 character maximum) with no success. I feel like this needs further assessment to identify just what is being stored here and why. For me, this may be related to Media as it happens on node save with featured image field.

unstatu made their first commit to this issue’s fork.

unstatu’s picture

I have created a MR implementing the change that was in #4.

I have also implemented a hook_update in order to update the existing field definitions in case they were already installed.

unstatu’s picture

The update database operation was failing if the table already contained data. Improved the patch to manage this situation

mahaveer003’s picture

Status: Needs review » Reviewed & tested by the community
mahaveer003’s picture

Status: Reviewed & tested by the community » Fixed

Thanks for your efforts merge change to branch (8.x-3.x)

Status: Fixed » Closed (fixed)

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