Cloning config entities doesn't validate length of machine name for ID.

Config entity IDs cannot be more than 32 characters for bundle sake.

To test:

  • Create a contact form
  • Clone it
  • Give it a really long name
  • Fatal error
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

larowlan created an issue. See original summary.

larowlan’s picture

Title: Clone feature doesn't validate length of machine name » Clone feature doesn't validate length of machine name for config entities
Project: Contact Storage » Entity Clone
larowlan’s picture

Title: Clone feature doesn't validate length of machine name for config entities » Clone form doesn't validate length of machine name for config entities
Issue summary: View changes
Status: Active » Needs review
FileSize
1.33 KB

Status: Needs review » Needs work

The last submitted patch, 3: 2754047-maxlength.patch, failed testing.

The last submitted patch, 3: 2754047-maxlength.patch, failed testing.

larowlan’s picture

Gah, so this is only for config entities that are bundles.

So we need a new class for those forms.

AsadKamil’s picture

Status: Needs work » Reviewed & tested by the community

Patch applied successfully and now we can give more than 70 chars to label and we can have only 32 letters for machine name.
machine name automatically take 32 chars from label name.Now it is not giving fatal error
Thanks

alan-ps’s picture

Status: Reviewed & tested by the community » Needs work

Change status to Needs work, in accordance with comment #6

vpeltot’s picture

Here a patch to solve this (older) issue !

  • Limit new config entities ids to 64 characters except for bundle definition that are limited to 32 characters.
  • Adding tests to cover these cases.
vpeltot’s picture

Status: Needs work » Needs review
optimusprime619’s picture

Thanks for the patch, encountered the same error when trying to clone a webform with a lengthy name

Drupal\Core\Config\Entity\Exception\ConfigEntityIdLengthException: Attempt to create a bundle with an ID longer than 32 characters: testing_a_clone_of_the_webform_with_more_than_32_characters_for_validation(). in Drupal\Core\Entity\EntityBase->preSave()

Issue resolved after updating the patch and the machine name was restricted to 32 characters.

larowlan’s picture

Status: Needs review » Reviewed & tested by the community

This is good to go, thanks for re-rolling

  • vpeltot committed 498a86f on 8.x-1.x
    Issue #2754047 by larowlan, vpeltot: Clone form doesn't validate length...
vpeltot’s picture

Status: Reviewed & tested by the community » Fixed

Commited.
Thanks.

Status: Fixed » Closed (fixed)

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