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

Coding exception thrown when viewing nested categories

    XMLWordPrintable

    Details

    • Difficulty:
      Easy
    • Affected Branches:
      MOODLE_21_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE, MOODLE_21_STABLE

      Description

      In certain situations (see testing instructions for an example), Moodle breaks while building the navigation tree. A "coding exception" message is displayed to the user.

      This occurs when a category of at least 2nd level is added to the navigation tree, in global_navigation::load_all_categories() .

      The problematic piece of code is near line 1454. The code tries to add all parent categories of a give category to the navigation tree, but fails to handle the root category (id=0) correctly.

      See patch attached for details of the problem. Note that this patch also fixes MDL-28254.

      Replication instructions:

      The database needs to contain a course category, and a subcategory of it.

      • Log in as admin
      • Navigate to: Site administration -> Courses -> Add/edit courses
      • Click on the name of the subcategory.
      • "Coding exception" message is now displayed.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  1/Aug/11