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

Moodle 2.0 Navigation tree algorithm faulty

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 2.0.3
    • Fix Version/s: 2.0.4, 2.1.1
    • Component/s: Navigation
    • Labels:
    • Environment:
      Likely to be any, probable to be any database
    • Database:
      Any
    • Testing Instructions:
      Hide
      1. Find a site with lots of courses and real branching series of categories... alternativily create one
      2. Browse to the front page, courses, categories, and modules.
      3. For each check the following:
        • The navigation generates correctly for what you are viewing
        • The navigation generates the surrounding information correctly as well
      Show
      Find a site with lots of courses and real branching series of categories... alternativily create one Browse to the front page, courses, categories, and modules. For each check the following: The navigation generates correctly for what you are viewing The navigation generates the surrounding information correctly as well
    • Workaround:
      Hide

      Replace Line 1270 with:
      $categories = $DB->get_records_select('course_categories', $select, $params, 'depth, sortorder');

      Show
      Replace Line 1270 with: $categories = $DB->get_records_select('course_categories', $select, $params, 'depth, sortorder');
    • Affected Branches:
      MOODLE_20_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE, MOODLE_21_STABLE
    • Pull Master Branch:
      wip-MDL-28040-master

      Description

      In Moodle 2.0.3 the navigation tree algorithm is flawed. In all cases where the 'sortorder' field has been variously changed from the default 999 by moving categories around, subcategories are likely to precede their parent categories in the $categories array, thus forcing an error:
      Warning: array_key_exists() expects parameter 2 to be array, null given in .../moodle/lib/navigationlib.php on line 1298
      ...and losing all the sub-categories located above the parent in that array!!
      ...and preventing navigation operating correctly on remaining sub-categories!

      Debugging on. Any case where a sub-category has a lower 'sortorder' value than its parent (which will of course have a lower 'depth' value)!
      But without debugging on you can still see the fault in the resultant tree.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

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

                  Dates

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