Nesting level too deep - recursive dependency on going to next question

Created on 29 June 2022, over 2 years ago
Updated 19 September 2023, over 1 year ago

Problem/Motivation

When going to next question with the 'Next' button I get: Fatal error: Nesting level too deep - recursive dependency? in [site]\web\modules\contrib\quiz\src\Entity\QuizResultAnswer.php on line 146.

I am unsure whether it is related to a specific matching question (for clarity I name it question qX)
I tried:

  • [quiz containing: q1-qX-q3], taking question qX out of the quiz: problem gone: I can go from q1 to q3 with the next button
  • In another quiz that worked fine [quiz containing: q4-q5], adding question qX to the end -->result: [quiz: q4-q5-qX]: problem appears when going from q5 to qX
  • re-saved question qX, with the thought: 'if this individual question possibly is corrupted, maybe resaving repairs it', but the issue remained
  • moved question qX up in the question order --> result: [quiz: q4-qX-q5]: now I can reach question qX with the next button, but the problem appears when I try to go from qX to the question thereafter q5
  • moved question X up to the begin of the quiz--> result: [quiz: qX-q4-q5]: now I can do question qX, go to question q4 with the next button, but the problem then appears when I try to go question q5

In all these cases I first deleted the quiz attempts.

I looked at the code at the indicated line 146. It is in function getPrevious() (not in getNext!)

Environment: Win10, XAMPP, PHP 8.1.6, D9.4.1, quiz 6.0.0-alpha7
Attached is what devel gives as variable for this question.

I am just trying out to get experience with the quiz module. The test quizzes and test questions I made have no importance. So if I would know it was only this specific question causing issues due to some kind of corruption of this question, I would not mind at all about the issue. But I make an issue report because I cannot judge whether this maybe does indicate a problem in quiz (that could occur in other quizzes with other questions too)

Steps to reproduce

So far only occurs when introducing this specific question qX in a quiz

๐Ÿ› Bug report
Status

Fixed

Version

6.0

Component

Code - Quiz core

Created by

๐Ÿ‡ณ๐Ÿ‡ฑNetherlands opgobee

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.

  • Hi, haven't applied the patch yet but the issue is activated by adding more than one question of the same type in the one quiz. Have tried all combinations of question type and its the same for all. Ive reordered the questions but as soon as the second instance of the question type is loaded the error 'Fatal error: Nesting level too deep - recursive dependency? in /code/web/modules/quiz/src/Entity/QuizResultAnswer.php on line 146'. Will try patch and see what happens.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States Chris Dart

    Chris Dart โ†’ made their first commit to this issueโ€™s fork.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States socketwench

    For those falling on this issue from a web search, the #6 patch neglects the ::getPrevious() method which is subject to the same error. The attached patch fixes it for 6.0.0-alpha7.

    Neither patch is necessary when using the dev version.

Production build 0.71.5 2024