Problem/Motivation

Warning: Undefined array key "#webform_key" in Drupal\webform\Plugin\WebformElement\WebformManagedFileBase->prepare() (line 301 of /code/web/modules/contrib/webform/src/Plugin/WebformElement/WebformManagedFileBase.php)

Steps to reproduce

on a webform filling/testing which has a composite element page perform an ajax action. forexample press + on a composite element to load more element via ajax

CommentFileSizeAuthor
#2 3502992-2.patch772 bytesb.ravanbakhsh

Issue fork webform-3502992

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

b.ravanbakhsh created an issue. See original summary.

b.ravanbakhsh’s picture

StatusFileSize
new772 bytes
eduardo morales alberti’s picture

Same error here.

Related issue with a similar approximation https://www.drupal.org/project/webform/issues/3343209

Full stack:

Message	Warning: Undefined array key "#webform_key" in Drupal\webform\Plugin\WebformElement\WebformManagedFileBase->prepare() (line 301 of /mysite/docroot/modules/contrib/webform/src/Plugin/WebformElement/WebformManagedFileBase.php) #0 /mysite/docroot/core/includes/bootstrap.inc(166): _drupal_error_handler_real() #1 /mysite/docroot/modules/contrib/webform/src/Plugin/WebformElement/WebformManagedFileBase.php(301): _drupal_error_handler() #2 /mysite/docroot/modules/contrib/webform/modules/webform_ui/src/Form/WebformUiElementTypeFormBase.php(308): Drupal\webform\Plugin\WebformElement\WebformManagedFileBase->prepare() #3 /mysite/docroot/modules/contrib/webform/modules/webform_ui/src/Form/WebformUiElementTypeFormBase.php(246): Drupal\webform_ui\Form\WebformUiElementTypeFormBase->buildElementPreview() #4 /mysite/docroot/modules/contrib/webform/modules/webform_ui/src/Form/WebformUiElementTypeSelectForm.php(78): Drupal\webform_ui\Form\WebformUiElementTypeFormBase->buildRow() #5 [internal function]: Drupal\webform_ui\Form\WebformUiElementTypeSelectForm->buildForm() #6 /mysite/docroot/core/lib/Drupal/Core/Form/FormBuilder.php(536): call_user_func_array() #7 /mysite/docroot/core/lib/Drupal/Core/Form/FormBuilder.php(284): Drupal\Core\Form\FormBuilder->retrieveForm() #8 /mysite/docroot/core/lib/Drupal/Core/Controller/FormController.php(73): Drupal\Core\Form\FormBuilder->buildForm() #9 [internal function]: Drupal\Core\Controller\FormController->getContentResult() #10 /mysite/docroot/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array() #11 /mysite/docroot/core/lib/Drupal/Core/Render/Renderer.php(669): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\@closure() #12 /mysite/docroot/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(121): Drupal\Core\Render\Renderer->executeInRenderContext() #13 /mysite/docroot/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() #14 /mysite/vendor/symfony/http-kernel/HttpKernel.php(181): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\@closure() #15 /mysite/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw() #16 /mysite/docroot/core/lib/Drupal/Core/StackMiddleware/Session.php(53): Symfony\Component\HttpKernel\HttpKernel->handle() #17 /mysite/docroot/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle() #18 /mysite/docroot/core/lib/Drupal/Core/StackMiddleware/ContentLength.php(28): Drupal\Core\StackMiddleware\KernelPreHandle->handle() #19 /mysite/vendor/asm89/stack-cors/src/Cors.php(53): Drupal\Core\StackMiddleware\ContentLength->handle() #20 /mysite/docroot/modules/contrib/shield/src/ShieldMiddleware.php(263): Asm89\Stack\Cors->handle() #21 /mysite/docroot/modules/contrib/shield/src/ShieldMiddleware.php(130): Drupal\shield\ShieldMiddleware->bypass() #22 /mysite/docroot/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\shield\ShieldMiddleware->handle() #23 /mysite/docroot/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() #24 /mysite/docroot/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(36): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() #25 /mysite/docroot/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\AjaxPageState->handle() #26 /mysite/docroot/core/lib/Drupal/Core/DrupalKernel.php(741): Drupal\Core\StackMiddleware\StackedHttpKernel->handle() #27 /mysite/docroot/index.php(19): Drupal\Core\DrupalKernel->handle() #28 @main.
liam morland’s picture

Status: Needs review » Needs work

Thanks for the patch.

Please put the patch into an issue fork and merge request.

jeremyr’s picture

Also running into this issue and the patch resolved the problem for me. Running: Webform 6.2.9 on Drupal 10.4.1

eduardo morales alberti’s picture

Created MR

eduardo morales alberti’s picture

Status: Needs work » Needs review

jrockowitz made their first commit to this issue’s fork.

jrockowitz’s picture

Status: Needs review » Fixed

Patch seems very safe.

Status: Fixed » Closed (fixed)

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

arno_vgh’s picture

Thanks for the patch! It successfully prevents the warnings.
However, does anyone have an explanation for why the #webform_key is missing? It seems like it has not been initialized properly or something, but I couldn't find the root cause. (Since it doesn’t break any functionality, I haven’t investigated further.)