Undefined array key triggered via Autosave Form module

Created on 17 August 2024, 5 months ago

The following error results on a 10.3.2 site where autosave_form is in stalled.

Error message
Warning: Undefined array key 0 in file_view_access_field_widget_form_process() (line 65 of modules/contrib/file_view_access/file_view_access.module).
file_view_access_field_widget_form_process(Array, Object, Array)
call_user_func_array('file_view_access_field_widget_form_process', Array) (Line: 1018)
Drupal\Core\Form\FormBuilder->doBuildForm('node_message_edit_form', Array, Object) (Line: 154)
Drupal\autosave_form\Form\AutosaveFormBuilder->doBuildForm('node_message_edit_form', Array, Object) (Line: 1081)
Drupal\Core\Form\FormBuilder->doBuildForm('node_message_edit_form', Array, Object) (Line: 154)
Drupal\autosave_form\Form\AutosaveFormBuilder->doBuildForm('node_message_edit_form', Array, Object) (Line: 1081)
Drupal\Core\Form\FormBuilder->doBuildForm('node_message_edit_form', Array, Object) (Line: 154)
Drupal\autosave_form\Form\AutosaveFormBuilder->doBuildForm('node_message_edit_form', Array, Object) (Line: 1081)
Drupal\Core\Form\FormBuilder->doBuildForm('node_message_edit_form', Array, Object) (Line: 154)
Drupal\autosave_form\Form\AutosaveFormBuilder->doBuildForm('node_message_edit_form', Array, Object) (Line: 579)
Drupal\Core\Form\FormBuilder->processForm('node_message_edit_form', Array, Object) (Line: 144)
Drupal\autosave_form\Form\AutosaveFormBuilder->processForm('node_message_edit_form', Array, Object) (Line: 326)
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: 638)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 121)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 181)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 53)
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: 36)
Drupal\Core\StackMiddleware\AjaxPageState->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 741)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

🐛 Bug report
Status

Active

Version

2.1

Component

Code

Created by

🇺🇸United States drupgirl

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

Comments & Activities

  • Issue created by @drupgirl
  • 🇺🇸United States drupgirl

    The module is set up correctly and the checkbox appears after the file is uploaded.

    The following error is thrown on the Create node page.

    Error message
    Warning: Undefined array key 0 in file_view_access_field_widget_form_process() (line 65 of modules/contrib/file_view_access/file_view_access.module).
    file_view_access_field_widget_form_process(Array, Object, Array)
    call_user_func_array('file_view_access_field_widget_form_process', Array) (Line: 1018)
    Drupal\Core\Form\FormBuilder->doBuildForm('node_message_form', Array, Object) (Line: 1081)
    Drupal\Core\Form\FormBuilder->doBuildForm('node_message_form', Array, Object) (Line: 1081)
    Drupal\Core\Form\FormBuilder->doBuildForm('node_message_form', Array, Object) (Line: 1081)
    Drupal\Core\Form\FormBuilder->doBuildForm('node_message_form', Array, Object) (Line: 579)
    Drupal\Core\Form\FormBuilder->processForm('node_message_form', Array, Object) (Line: 326)
    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: 638)
    Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 121)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 181)
    Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 76)
    Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 53)
    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: 36)
    Drupal\Core\StackMiddleware\AjaxPageState->handle(Object, 1, 1) (Line: 51)
    Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 741)
    Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

    *edit note: this has nothing to do a autosave

  • Status changed to Needs review 5 months ago
  • 🇮🇳India sarwan_verma

    Hi,
    I have resolved the 'Undefined array key' issue and attached the patch.
    Please review verify .
    Thanks!

  • Assigned to hetal.solanki
  • 🇮🇳India hetal.solanki

    @all

    I have try to reproduce Issue in Drupal Version 10.3.2. But i am unable to reproduce Issue. Is any can help me to do it?

    I have mention step which i have do to reproduce it.

    1. Installed `composer require 'drupal/file_view_access:^2.1'`
    2. Using drush unable module
    3. After that try to install autosave_form `composer require 'drupal/autosave_form:^1.7'`

    This are the step I've tried. Please correct me if I am missing any steps.

    Thank you!!

  • 🇵🇭Philippines ambot112

    Able to successfully apply patch from !3.

Production build 0.71.5 2024