Notice: Trying to access array offset on value of type null in Drupal\Core\Menu\Plugin\Block\LocalTasksBlock->blockSubmit() (line 153 of core/lib/Drupal/Core/Menu/Plugin/Block/LocalTasksBlock.php).

Created on 10 June 2021, over 3 years ago
Updated 29 July 2024, 4 months ago

Problem/Motivation

There is an error after save

Mensaje de error
Close
Notice: Trying to access array offset on value of type null in Drupal\Core\Menu\Plugin\Block\LocalTasksBlock->blockSubmit() (line 153 of core/lib/Drupal/Core/Menu/Plugin/Block/LocalTasksBlock.php).
Drupal\Core\Menu\Plugin\Block\LocalTasksBlock->blockSubmit(Array, Object) (Line: 227)
Drupal\Core\Block\BlockBase->submitConfigurationForm(Array, Object) (Line: 750)
Drupal\context\Plugin\ContextReaction\Blocks->submitConfigurationForm(Array, Object) (Line: 207)
Drupal\context_ui\Form\ContextFormBase->handleReactions(Array, Object) (Line: 150)
Drupal\context_ui\Form\ContextFormBase->submitForm(Array, Object)
call_user_func_array(Array, Array) (Line: 113)
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object) (Line: 51)
Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object) (Line: 593)
Drupal\Core\Form\FormBuilder->processForm('context_edit_form', Array, Object) (Line: 144)
Drupal\autosave_form\Form\AutosaveFormBuilder->processForm('context_edit_form', Array, Object) (Line: 321)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 97)
Drupal\autosave_form\Form\AutosaveFormBuilder->buildForm(Object, Object) (Line: 73)
Drupal\Core\Controller\FormController->getContentResult(Object, Object) (Line: 39)
Drupal\layout_builder\Controller\LayoutBuilderHtmlEntityFormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 573)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 158)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 80)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 706)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Steps to reproduce

  1. Create a new context
  2. Add a block
  3. Save
  4. Edit the context
  5. Move the block to another region
  6. Click on Save and Continue

Core 9.1.10

πŸ› Bug report
Status

Active

Version

4.0

Component

Code

Created by

πŸ‡¨πŸ‡΄Colombia Freddy Rodriguez BogotΓ‘

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡¨πŸ‡΄Colombia Freddy Rodriguez BogotΓ‘
  • πŸ‡ΊπŸ‡ΈUnited States pdxclankeith

    I've run into this same problem on Drupal 10.1.5 and Context 5.0.0-rc1. Has there been any movement on getting a fix/patch for this?

    Error message is for the SystemBrandingBlock:

    Warning: Trying to access array offset on value of type null in Drupal\system\Plugin\Block\SystemBrandingBlock->blockSubmit() (line 142 of core/modules/system/src/Plugin/Block/SystemBrandingBlock.php).
    Drupal\system\Plugin\Block\SystemBrandingBlock->blockSubmit(Array, Object) (Line: 234)
    Drupal\Core\Block\BlockBase->submitConfigurationForm(Array, Object) (Line: 756)
    Drupal\context\Plugin\ContextReaction\Blocks->submitConfigurationForm(Array, Object) (Line: 207)
    Drupal\context_ui\Form\ContextFormBase->handleReactions(Array, Object) (Line: 150)
    Drupal\context_ui\Form\ContextFormBase->submitForm(Array, Object)
    call_user_func_array(Array, Array) (Line: 114)
    Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object) (Line: 52)
    Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object) (Line: 597)
    Drupal\Core\Form\FormBuilder->processForm('context_edit_form', Array, Object) (Line: 325)
    Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 73)
    Drupal\Core\Controller\FormController->getContentResult(Object, Object) (Line: 39)
    Drupal\layout_builder\Controller\LayoutBuilderHtmlEntityFormController->getContentResult(Object, Object)
    call_user_func_array(Array, Array) (Line: 123)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 617)
    Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 182)
    Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 76)
    Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
    Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
    Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
    Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
    Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 48)
    Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
    Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 51)
    Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 704)
    Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
    
  • πŸ‡¬πŸ‡§United Kingdom mistergroove

    This issue still exists for me on both 8.x-4.x and 5.0.0-rc1

    Warning: Trying to access array offset on value of type null in Drupal\system\Plugin\Block\SystemBrandingBlock->blockSubmit() (line 142 of core/modules/system/src/Plugin/Block/SystemBrandingBlock.php).
    Warning: Trying to access array offset on value of type null in Drupal\system\Plugin\Block\SystemBrandingBlock->blockSubmit() (line 143 of core/modules/system/src/Plugin/Block/SystemBrandingBlock.php).
    Warning: Trying to access array offset on value of type null in Drupal\system\Plugin\Block\SystemBrandingBlock->blockSubmit() (line 144 of core/modules/system/src/Plugin/Block/SystemBrandingBlock.php).

  • πŸ‡·πŸ‡΄Romania cslevy

    This will happen for all Blocks, that has a hierarchical structure in the form.

    $block_state = (new FormState())->setValues($configuration);
    $block->submitConfigurationForm($form, $block_state);
    

    Here the FormState is initialised with the $configuration values which is a simple array, but if you check the SystemBrandingBlock or LocalTasksBlock blockSubmits, you can see that the values from the fieldset are moved to the top level values.

    So this is a general issue, and will show up for every block which has hierarchical form structure.

Production build 0.71.5 2024