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

Moodle 2.0 Navigation tree algorithm faulty

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Blocker
    • Resolution: Fixed
    • 2.0.3
    • 2.0.4, 2.1.1
    • Navigation
    • Likely to be any, probable to be any database
    • Any
    • MOODLE_20_STABLE
    • MOODLE_20_STABLE, MOODLE_21_STABLE
    • wip-MDL-28040-master
    • 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');
    • 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

    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.

      Attachments

        Issue Links

          Activity

            People

              samhemelryk Sam Hemelryk
              jwhite10 John White
              Petr Skoda Petr Skoda
              Michael de Raadt Michael de Raadt
              David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo
              Votes:
              2 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                1/Aug/11