Unexpected error on quiz submit

Created on 5 July 2023, over 1 year ago
Updated 16 August 2023, over 1 year ago

Problem/Motivation

When I try to submit a form with a quiz, I get an unexpected error.

TypeError: Drupal\webform_quiz\QuizResults::__construct(): Argument #1 ($webformSubmission) must be of type Drupal\webform_quiz\WebformSubmission, Drupal\webform\Entity\WebformSubmission given, called in /var/www/drupal/web/modules/contrib/webform_quiz/src/Helper/ScoreCalculator.php on line 17 w Drupal\webform_quiz\QuizResults->__construct() (linia 38 w /var/www/drupal/web/modules/contrib/webform_quiz/src/QuizResults.php)
#0 /var/www/drupal/web/modules/contrib/webform_quiz/src/Helper/ScoreCalculator.php(17): Drupal\webform_quiz\QuizResults->__construct()
#1 /var/www/drupal/web/modules/contrib/webform_quiz/src/Helper/CalculatorBase.php(32): Drupal\webform_quiz\Helper\ScoreCalculator->calculate()
#2 /var/www/drupal/web/modules/contrib/webform_quiz/includes/webform_quiz.webform.inc(79): Drupal\webform_quiz\Helper\CalculatorBase->__construct()
#3 [internal function]: webform_quiz_webform_submission_presave()
#4 /var/www/drupal/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(426): call_user_func_array()
#5 /var/www/drupal/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(405): Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}()
#6 /var/www/drupal/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(433): Drupal\Core\Extension\ModuleHandler->invokeAllWith()
#7 /var/www/drupal/web/core/lib/Drupal/Core/Entity/EntityStorageBase.php(249): Drupal\Core\Extension\ModuleHandler->invokeAll()
#8 /var/www/drupal/web/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php(900): Drupal\Core\Entity\EntityStorageBase->invokeHook()
#9 /var/www/drupal/web/core/lib/Drupal/Core/Entity/EntityStorageBase.php(563): Drupal\Core\Entity\ContentEntityStorageBase->invokeHook()
#10 /var/www/drupal/web/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php(753): Drupal\Core\Entity\EntityStorageBase->doPreSave()
#11 /var/www/drupal/web/modules/contrib/webform/src/WebformSubmissionStorage.php(966): Drupal\Core\Entity\ContentEntityStorageBase->doPreSave()
#12 /var/www/drupal/web/core/lib/Drupal/Core/Entity/EntityStorageBase.php(517): Drupal\webform\WebformSubmissionStorage->doPreSave()
#13 /var/www/drupal/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php(804): Drupal\Core\Entity\EntityStorageBase->save()
#14 /var/www/drupal/web/modules/contrib/webform/src/WebformSubmissionStorage.php(983): Drupal\Core\Entity\Sql\SqlContentEntityStorage->save()
#15 /var/www/drupal/web/core/lib/Drupal/Core/Entity/EntityBase.php(339): Drupal\webform\WebformSubmissionStorage->save()
#16 /var/www/drupal/web/modules/contrib/webform/src/Entity/WebformSubmission.php(901): Drupal\Core\Entity\EntityBase->save()
#17 /var/www/drupal/web/modules/contrib/webform/src/WebformSubmissionForm.php(1995): Drupal\webform\Entity\WebformSubmission->save()
#18 /var/www/drupal/web/modules/contrib/webform/src/WebformSubmissionForm.php(1705): Drupal\webform\WebformSubmissionForm->save()
#19 /var/www/drupal/web/modules/contrib/webform/src/WebformSubmissionForm.php(1666): Drupal\webform\WebformSubmissionForm->wizardSubmit()
#20 /var/www/drupal/web/modules/contrib/webform/src/WebformSubmissionForm.php(1626): Drupal\webform\WebformSubmissionForm->next()
#21 [internal function]: Drupal\webform\WebformSubmissionForm->submit()
#22 /var/www/drupal/web/core/lib/Drupal/Core/Form/FormSubmitter.php(114): call_user_func_array()
#23 /var/www/drupal/web/core/lib/Drupal/Core/Form/FormSubmitter.php(52): Drupal\Core\Form\FormSubmitter->executeSubmitHandlers()
#24 /var/www/drupal/web/core/lib/Drupal/Core/Form/FormBuilder.php(597): Drupal\Core\Form\FormSubmitter->doSubmitForm()
#25 /var/www/drupal/web/core/lib/Drupal/Core/Form/FormBuilder.php(325): Drupal\Core\Form\FormBuilder->processForm()
#26 /var/www/drupal/web/core/lib/Drupal/Core/Entity/EntityFormBuilder.php(48): Drupal\Core\Form\FormBuilder->buildForm()
#27 /var/www/drupal/web/modules/contrib/webform/src/Entity/Webform.php(1249): Drupal\Core\Entity\EntityFormBuilder->getForm()
#28 /var/www/drupal/web/modules/contrib/webform/src/Element/Webform.php(79): Drupal\webform\Entity\Webform->getSubmissionForm()
#29 [internal function]: Drupal\webform\Element\Webform::preRenderWebformElement()
#30 /var/www/drupal/web/core/lib/Drupal/Core/Security/DoTrustedCallbackTrait.php(101): call_user_func_array()
#31 /var/www/drupal/web/core/lib/Drupal/Core/Render/Renderer.php(788): Drupal\Core\Render\Renderer->doTrustedCallback()
#32 /var/www/drupal/web/core/lib/Drupal/Core/Render/Renderer.php(374): Drupal\Core\Render\Renderer->doCallback()
#33 /var/www/drupal/web/core/lib/Drupal/Core/Render/Renderer.php(204): Drupal\Core\Render\Renderer->doRender()
#34 /var/www/drupal/web/core/lib/Drupal/Core/Template/TwigExtension.php(479): Drupal\Core\Render\Renderer->render()
#35 /var/www/drupal/vendor/twig/twig/src/Environment.php(418) : eval()'d code(88): Drupal\Core\Template\TwigExtension->escapeFilter()
#36 /var/www/drupal/vendor/twig/twig/src/Template.php(405): __TwigTemplate_4180004131320d951007a13b2aaf8a22->doDisplay()
#37 /var/www/drupal/vendor/twig/twig/src/Template.php(378): Twig\Template->displayWithErrorHandling()
#38 /var/www/drupal/vendor/twig/twig/src/Template.php(390): Twig\Template->display()
#39 /var/www/drupal/web/core/themes/engines/twig/twig.engine(55): Twig\Template->render()
#40 /var/www/drupal/web/core/lib/Drupal/Core/Theme/ThemeManager.php(384): twig_render_template()
#41 /var/www/drupal/web/core/lib/Drupal/Core/Render/Renderer.php(433): Drupal\Core\Theme\ThemeManager->render()
#42 /var/www/drupal/web/core/lib/Drupal/Core/Render/Renderer.php(446): Drupal\Core\Render\Renderer->doRender()
#43 /var/www/drupal/web/core/lib/Drupal/Core/Render/Renderer.php(204): Drupal\Core\Render\Renderer->doRender()
#44 /var/www/drupal/web/core/lib/Drupal/Core/Template/TwigExtension.php(479): Drupal\Core\Render\Renderer->render()
#45 /var/www/drupal/vendor/twig/twig/src/Environment.php(418) : eval()'d code(70): Drupal\Core\Template\TwigExtension->escapeFilter()
#46 /var/www/drupal/vendor/twig/twig/src/Template.php(182): __TwigTemplate_3c5dcb11456f77f4d165d59d1b07a994->block_content()
#47 /var/www/drupal/vendor/twig/twig/src/Environment.php(418) : eval()'d code(58): Twig\Template->displayBlock()
#48 /var/www/drupal/vendor/twig/twig/src/Template.php(182): __TwigTemplate_3c5dcb11456f77f4d165d59d1b07a994->block_paragraph()
#49 /var/www/drupal/vendor/twig/twig/src/Environment.php(418) : eval()'d code(46): Twig\Template->displayBlock()
#50 /var/www/drupal/vendor/twig/twig/src/Template.php(405): __TwigTemplate_3c5dcb11456f77f4d165d59d1b07a994->doDisplay()
#51 /var/www/drupal/vendor/twig/twig/src/Template.php(378): Twig\Template->displayWithErrorHandling()
#52 /var/www/drupal/vendor/twig/twig/src/Template.php(390): Twig\Template->display()
#53 /var/www/drupal/web/core/themes/engines/twig/twig.engine(55): Twig\Template->render()
#54 /var/www/drupal/web/core/lib/Drupal/Core/Theme/ThemeManager.php(384): twig_render_template()
#55 /var/www/drupal/web/core/lib/Drupal/Core/Render/Renderer.php(433): Drupal\Core\Theme\ThemeManager->render()
#56 /var/www/drupal/web/core/lib/Drupal/Core/Render/Renderer.php(204): Drupal\Core\Render\Renderer->doRender()
#57 /var/www/drupal/web/core/lib/Drupal/Core/Template/TwigExtension.php(479): Drupal\Core\Render\Renderer->render()
#58 /var/www/drupal/vendor/twig/twig/src/Environment.php(418) : eval()'d code(68): Drupal\Core\Template\TwigExtension->escapeFilter()
#59 /var/www/drupal/vendor/twig/twig/src/Template.php(405): __TwigTemplate_4180004131320d951007a13b2aaf8a22->doDisplay()
#60 /var/www/drupal/vendor/twig/twig/src/Template.php(378): Twig\Template->displayWithErrorHandling()
#61 /var/www/drupal/vendor/twig/twig/src/Template.php(390): Twig\Template->display()
#62 /var/www/drupal/web/core/themes/engines/twig/twig.engine(55): Twig\Template->render()
#63 /var/www/drupal/web/core/lib/Drupal/Core/Theme/ThemeManager.php(384): twig_render_template()
#64 /var/www/drupal/web/core/lib/Drupal/Core/Render/Renderer.php(433): Drupal\Core\Theme\ThemeManager->render()
#65 /var/www/drupal/web/core/lib/Drupal/Core/Render/Renderer.php(204): Drupal\Core\Render\Renderer->doRender()
#66 /var/www/drupal/web/core/lib/Drupal/Core/Template/TwigExtension.php(479): Drupal\Core\Render\Renderer->render()
#67 /var/www/drupal/vendor/twig/twig/src/Environment.php(418) : eval()'d code(125): Drupal\Core\Template\TwigExtension->escapeFilter()
#68 /var/www/drupal/vendor/twig/twig/src/Template.php(405): __TwigTemplate_16ad4dbef62e7ad3935825456c4edf54->doDisplay()
#69 /var/www/drupal/vendor/twig/twig/src/Template.php(378): Twig\Template->displayWithErrorHandling()
#70 /var/www/drupal/vendor/twig/twig/src/Template.php(390): Twig\Template->display()
#71 /var/www/drupal/web/core/themes/engines/twig/twig.engine(55): Twig\Template->render()
#72 /var/www/drupal/web/core/lib/Drupal/Core/Theme/ThemeManager.php(384): twig_render_template()
#73 /var/www/drupal/web/core/lib/Drupal/Core/Render/Renderer.php(433): Drupal\Core\Theme\ThemeManager->render()
#74 /var/www/drupal/web/core/lib/Drupal/Core/Render/Renderer.php(204): Drupal\Core\Render\Renderer->doRender()
#75 /var/www/drupal/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(242): Drupal\Core\Render\Renderer->render()
#76 /var/www/drupal/web/core/lib/Drupal/Core/Render/Renderer.php(580): Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}()
#77 /var/www/drupal/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(243): Drupal\Core\Render\Renderer->executeInRenderContext()
#78 /var/www/drupal/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(132): Drupal\Core\Render\MainContent\HtmlRenderer->prepare()
#79 /var/www/drupal/web/core/lib/Drupal/Core/EventSubscriber/MainContentViewSubscriber.php(90): Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse()
#80 [internal function]: Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray()
#81 /var/www/drupal/web/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(142): call_user_func()
#82 /var/www/drupal/vendor/symfony/http-kernel/HttpKernel.php(174): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch()
#83 /var/www/drupal/vendor/symfony/http-kernel/HttpKernel.php(81): Symfony\Component\HttpKernel\HttpKernel->handleRaw()
#84 /var/www/drupal/web/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Symfony\Component\HttpKernel\HttpKernel->handle()
#85 /var/www/drupal/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle()
#86 /var/www/drupal/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle()
#87 /var/www/drupal/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass()
#88 /var/www/drupal/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle()
#89 /var/www/drupal/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
#90 /var/www/drupal/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
#91 /var/www/drupal/web/core/lib/Drupal/Core/DrupalKernel.php(718): Stack\StackedHttpKernel->handle()
#92 /var/www/drupal/web/index.php(19): Drupal\Core\DrupalKernel->handle()
#93 {main}

Proposed resolution

I create patch to fix that issue.

🐛 Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

🇵🇱Poland bronismateusz

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

Comments & Activities

Production build 0.71.5 2024