Fatal error and WSOD when Quiz answer entered

Created on 27 June 2023, over 1 year ago
Updated 29 August 2024, 5 months ago

I have a set of quizzes that have run properly for 2 years plus.

Recently I have started getting a WSOD message after submitting an answer to any of the quizzes that:

"Fatal error: Nesting level too deep - recursive dependency? in /app/web/modules/contrib/quiz/src/Entity/QuizResultAnswer.php on line 146"

I am using Quix 6.0 Alpha 7, Views Export Data 1.3, and php 8.20 and Drupal Core 9.5.5

I cannot find any reference to this issue on the Quiz Issues List.

Can anyone help?

🐛 Bug report
Status

Closed: outdated

Version

6.0

Component

Code - Quiz core

Created by

Live updates comments and jobs are added and updated live.
  • Needs issue summary update

    Issue summaries save everyone time if they are kept up-to-date. See Update issue summary task instructions.

Sign in to follow issues

Comments & Activities

  • Issue created by @Andy-vv
  • 🇺🇸United States djdevin Philadelphia

    Very likely this is 🐛 Nesting level too deep - recursive dependency on going to next question Fixed .

    Try updating the module to the latest -dev release.

    It's possible a PHP upgrade could have caused the issue.

  • Many thanks @djdevin - the error message is the same one as in " #3293228: Nesting level too deep - recursive dependency on going to next question. " Odd that I didn't find it in my search.

    I installed 6x-dev of Quiz, and the recursive error did disappear and I could complete a quiz. However, after the quiz is complete the results will not display and I get the error description below. I'm a newbie in terms of understanding these types of things, but I am wondering if it is related to an effect of a callback function in the dev version of the module as the error message quotes https://www.drupal.org/node/2966725 . Is this perhaps something that is getting activated as a result of my php version 8.20? If it is I am a bit stuck as I don't really want to roll back to php 7.30 as it will cause all sorts of other issues as I move towards D10.
    I'm laos not sure how to test this further. Is there a patch I could put on to Quiz Alpha-6 just for the recursive error to see if that code will run without the callback error?

    ERROR QUOTE

    Deprecated function: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in Drupal\filter\Element\ProcessedText::preRenderText() (line 101 of core/modules/filter/src/Element/ProcessedText.php).

    Drupal\filter\Element\ProcessedText::preRenderText(Array)
    call_user_func_array(Array, Array) (Line: 101)
    Drupal\Core\Render\Renderer->doTrustedCallback(Array, Array, 'Render #pre_render callbacks must be methods of a class that implements \Drupal\Core\Security\TrustedCallbackInterface or be an anonymous function. The callback was %s. See https://www.drupal.org/node/2966725 ', 'exception', 'Drupal\Core\Render\Element\RenderCallbackInterface') (Line: 788)
    Drupal\Core\Render\Renderer->doCallback('#pre_render', Array, Array) (Line: 374)
    Drupal\Core\Render\Renderer->doRender(Array, 1) (Line: 204)
    Drupal\Core\Render\Renderer->render(Array, 1) (Line: 160)
    Drupal\Core\Render\Renderer->Drupal\Core\Render\{closure}() (Line: 580)
    Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 161)
    Drupal\Core\Render\Renderer->renderPlain(Array) (Line: 303)
    check_markup(NULL, NULL) (Line: 146)
    Drupal\quiz_multichoice\Plugin\quiz\QuizQuestion\MultichoiceResponse->getFeedbackValues() (Line: 56)
    Drupal\quiz\View\QuizResultAnswerViewBuilder->alterBuild(Array, Object, Object, 'question') (Line: 292)
    Drupal\Core\Entity\EntityViewBuilder->buildMultiple(Array) (Line: 239)
    Drupal\Core\Entity\EntityViewBuilder->build(Array)
    call_user_func_array(Array, Array) (Line: 101)
    Drupal\Core\Render\Renderer->doTrustedCallback(Array, Array, 'Render #pre_render callbacks must be methods of a class that implements \Drupal\Core\Security\TrustedCallbackInterface or be an anonymous function. The callback was %s. See https://www.drupal.org/node/2966725 ', 'exception', 'Drupal\Core\Render\Element\RenderCallbackInterface') (Line: 788)
    Drupal\Core\Render\Renderer->doCallback('#pre_render', Array, Array) (Line: 374)
    Drupal\Core\Render\Renderer->doRender(Array, 1) (Line: 204)
    Drupal\Core\Render\Renderer->render(Array, 1) (Line: 148)
    Drupal\Core\Render\Renderer->Drupal\Core\Render\{closure}() (Line: 580)
    Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 149)
    Drupal\Core\Render\Renderer->renderRoot(Array) (Line: 56)
    Drupal\quiz\View\QuizResultViewBuilder->alterBuild(Array, Object, Object, 'full') (Line: 292)
    Drupal\Core\Entity\EntityViewBuilder->buildMultiple(Array) (Line: 239)
    Drupal\Core\Entity\EntityViewBuilder->build(Array)
    call_user_func_array(Array, Array) (Line: 101)
    Drupal\Core\Render\Renderer->doTrustedCallback(Array, Array, 'Render #pre_render callbacks must be methods of a class that implements \Drupal\Core\Security\TrustedCallbackInterface or be an anonymous function. The callback was %s. See https://www.drupal.org/node/2966725 ', 'exception', 'Drupal\Core\Render\Element\RenderCallbackInterface') (Line: 788)
    Drupal\Core\Render\Renderer->doCallback('#pre_render', Array, Array) (Line: 374)
    Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 204)
    Drupal\Core\Render\Renderer->render(Array, ) (Line: 242)
    Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 580)
    Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 243)
    Drupal\Core\Render\MainContent\HtmlRenderer->prepare(Array, Object, Object) (Line: 132)
    Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object, Object) (Line: 90)
    Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object, 'kernel.view', Object)
    call_user_func(Array, Object, 'kernel.view', Object) (Line: 142)
    Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object, 'kernel.view') (Line: 174)
    Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 81)
    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: 23)
    Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 718)
    Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

    UNQUOTE

  • 🇺🇸United States djdevin Philadelphia

    Yes I believe that's related to PHP 8.2. 8.0 should be more forgiving if you can roll back to that until Quiz is fully PHP 8.2/Drupal 10 compliant.

  • 🇬🇧United Kingdom unqunq

    I had the same issue and my solution was to add ->id() to the comparison. I'm not sure if it will suffice but it got me going in my case:

    if ($qra->id() == $this->id()) {

    It comes up in multiple places.

  • 🇺🇸United States dumbtube Sacramento

    I saw this when moving from php7.4 to 8.1

    taking a quiz, after answering the first question and clicking on 'Next' results in the Fatal PHP error seen above.

    Ii fixed it by changing the two lines in the functions getNext() and getPrevious() from:

    if ($qra == $this) {

    to

    if ($qra === $this) {

    and things seem to work as before.

  • 🇮🇳India mohd sahzad

    I have updated for this issue : Fatal error and WSOD when Quiz answer entered, so please review attached patch1

  • Status changed to Postponed: needs info 6 months ago
  • 🇺🇸United States smustgrave

    Wonder if new steps can be provided, else going to close out.

  • Status changed to Closed: outdated 5 months ago
  • 🇺🇸United States smustgrave

    Since there hasn't been a follow up going to close out for now

Production build 0.71.5 2024