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

Choosing 'Combo-list' in the front-settings page with no visible categories causes error.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • 2.1.7, 2.2.4
    • 2.0.9, 2.1, 2.2.3
    • Course
    • MOODLE_20_STABLE, MOODLE_21_STABLE, MOODLE_22_STABLE
    • MOODLE_21_STABLE, MOODLE_22_STABLE
    • Hide
      1. Log in as admin
      2. Go to Admin > Courses > Add/edit courses
      3. Hide all categories
      4. Go to Admin > Front Page > Front Page settings
      5. In the setting 'frontpage' select 'Combo list' from one of the dropdowns
      6. Log out
      7. Visit front page
      8. Verify that no errors are displayed
      9. Log back in as admin, unhide some categories
      10. Log back out and verify that the categories are dislayed
      Show
      Log in as admin Go to Admin > Courses > Add/edit courses Hide all categories Go to Admin > Front Page > Front Page settings In the setting 'frontpage' select 'Combo list' from one of the dropdowns Log out Visit front page Verify that no errors are displayed Log back in as admin, unhide some categories Log back out and verify that the categories are dislayed

      The error -

      Coding error detected, it must be fixed by a programmer: moodle_database::get_in_or_equal() does not accept empty arrays

      More information about this error
      Stack trace:

      line 595 of \lib\dml\moodle_database.php: coding_exception thrown
      line 2097 of \course\lib.php: call to moodle_database->get_in_or_equal()
      line 235 of \index.php: call to get_course_category_tree()

      The error happens when the front-page setting is set to 'Combo List' and all categories have been set to hidden, with the user logged in not given the capability to view hidden categories. The array called $categoryids is not being populated with any values because it skips adding the hidden categories, so remains empty. In the code when looping through the categories it checks to see if it is visible, and if it isn't and the user does not have the 'moodle/category:viewhiddencategories' capability then it will not be added to this array. So, in some cases, no categories are ever added which creates the 'does not accept empty arrays' error.

            poltawski Dan Poltawski
            markn Mark Nelson
            Sam Hemelryk Sam Hemelryk
            Andrew Davis Andrew Davis
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

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