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

Avoid infinite loops when moode gets course_category structure

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Critical Critical
    • 1.9
    • 1.7.1
    • Course
    • None
    • MOODLE_17_STABLE
    • MOODLE_19_STABLE

      If the course_category database in moodle have a course_category which is your own parent (course_category->parent=course_category_id)
      moodle do an infinite loops trying to build course_category tree, and consumig all memory in the server.

      i suggest to avoid this add a line in lib/datalib.php

      on the function get_categories

      in the foreach (line 802):

      foreach ($categories as $key => $category) {
      if (!$category->visible) {
      if (!$creator)

      { unset($categories[$key]); }
      }
      }

      chage to:

      foreach ($categories as $key => $category) {
      if (!$category->visible) {
      if (!$creator) { unset($categories[$key]); }

      }
      //Changed code
      if ($category->id==$category->parent) unset($categories[$key]);
      }

            martinlanghoff Martín Langhoff (Inactive)
            bozohrj Carlos Alexandre S. da Fonseca (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.