OutOfBoundsException: Invalid delta "2" in Drupal\layout_builder\Entity\LayoutBuilderEntityViewDisplay->getSection() (line 41 of /app/web/core/modules/layout_builder/src/SectionStorage/SectionStorageTrait.php).

is thrown when a 3th seciton is added.

I reproduced this on vanilla drupal

Steps to reproduce

- For a content type, enable "Layout builder" and "Allow each content item to have its layout customized"

- On content type level: Create header section with all layout builder lock settings enabled except "Do not allow adding a new section after this section" and " Do not allow updating default blocks"

- On content type level: Add a "Custom block" as header in this header section

Now, create a new node for this content type

- add a new section (This will silently fail, the error above is not explicit thrown but it silently discarded I think)
- add a new section (2nd will fail and throw the error).

CommentFileSizeAuthor
#2 3150489-2.patch1.47 KBswentel

Comments

StryKaizer created an issue. See original summary.

swentel’s picture

Status: Active » Needs review
StatusFileSize
new1.47 KB

This should do it. Tests should pass normally, and I'm not even sure I have to add additional ones.

  • swentel committed 2a68eb3 on 8.x-1.x
    Issue #3150489 by swentel: Out of Bounds error when adding a 3th section
    
swentel’s picture

Status: Needs review » Fixed

committed and push, will do a new release also.

swentel’s picture

Status: Fixed » Closed (fixed)