Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-35547

Inifinite loop if question category points to itself as a parent

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.2.5, 2.3, 2.4
    • Fix Version/s: 2.2.6, 2.3.3
    • Component/s: Questions
    • Labels:
    • Testing Instructions:
      Hide

      1. Create several question categories and sub-categories in a course (the more the better).
      2. Confirm all categories are displayed OK in a drop-down on question/edit.php?courseid=N page.
      3. Edit database by hand to create a loop: in table mdl_question_categories find a top-level (with parent=0) category from your course and change parent to the id of one of the children.
      4. Confirm that an exception is thrown, instead of infinite loop and timeout (previous behaviour)
      5 Repeat 3 & 4 but change mdl_question_categories.parent to ID of one of the grand-children and finally to the id of the top-level category itself.

      Show
      1. Create several question categories and sub-categories in a course (the more the better). 2. Confirm all categories are displayed OK in a drop-down on question/edit.php?courseid=N page. 3. Edit database by hand to create a loop: in table mdl_question_categories find a top-level (with parent=0) category from your course and change parent to the id of one of the children. 4. Confirm that an exception is thrown, instead of infinite loop and timeout (previous behaviour) 5 Repeat 3 & 4 but change mdl_question_categories.parent to ID of one of the grand-children and finally to the id of the top-level category itself.
    • Affected Branches:
      MOODLE_22_STABLE, MOODLE_23_STABLE, MOODLE_24_STABLE
    • Fixed Branches:
      MOODLE_22_STABLE, MOODLE_23_STABLE
    • Pull Master Branch:

      Description

      After an upgrade, we have got some question categories to point to themselves as a parent. That is mdl_question_categories.id == mdl_question_categories.parent.
      This is causing question_categorylist() function to go into infinite loop, until all the resources available (memory) is used up.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Votes:
                  0 Vote for this issue
                  Watchers:
                  2 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Fix Release Date:
                    12/Nov/12