in some cases when avoiding layout by default of a content type, the Undefined offset error appears: $ section_number in Drupal \ layout_builder_lock \ LayoutBuilderLock :: preRender ().

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mmaldonado created an issue. See original summary.

swentel’s picture

Hmm, is there a way to reproduce this easily? Although I guess it couldn't hurt to add more checks there, but would great to get that in a test :)

mmaldonado’s picture

mmaldonado’s picture

Hello, if it is as you say with a simple control before iterating it is resolved, so this error would be somewhat small. In my case I get the error in Drupal 8.8.3 when editing a content type that by default has 4 Sections and the 4 sections have the options selected:

  • Do not allow configuring the section
  • Do not allow adding a new section before this section
  • Do not allow adding a new section after this section

  and if it serves as info I have installed the modules: grid_layout, layout_builder_base, layout_builder_extra_templates, layout_builder_lock, layout_builder_modal, layout_builder_restrictions, layout_builder_styles and layout_library.
regards

swentel’s picture

Ok thanks for the info and patch, will try to reproduce and review more next week!

mmaldonado’s picture

thanks to you, nice weekend.

mmaldonado’s picture

mmaldonado’s picture

mmaldonado’s picture

swentel’s picture

So good news, this error starts popping up as soon as you have 3 sections. Will see if I can write a test for it!

swentel’s picture

FileSize
2.14 KB

This is a failing test. It will fail on the PHP notice.
There's a second problem I see. Even though the last section is configured to not show the add section links etc, it still shows it - even though the link behind gives access denied.

swentel’s picture

Status: Active » Needs review

Status: Needs review » Needs work

The last submitted patch, 11: 3121250-11-fail.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

swentel’s picture

Status: Needs work » Needs review

This patch fixes the notice, but proves that there's still a problem with links not being hidden like 'Add section' or 'Configure section'.

swentel’s picture

FileSize
3.04 KB

And now with patch ....

Status: Needs review » Needs work

The last submitted patch, 15: 3121250-15-fail.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

swentel’s picture

Status: Needs work » Needs review
FileSize
3.86 KB

And this fixes it all.

  • swentel committed 5b2d35a on 8.x-1.x
    Issue #3121250 by swentel, mmaldonado:  Undefined offset $section_number...
swentel’s picture

Status: Needs review » Fixed

And fixed, thanks for the report!
Will push another release too in a few minutes.

swentel’s picture

Status: Fixed » Closed (fixed)
mmaldonado’s picture

super, thanks .....