-
Bug
-
Resolution: Fixed
-
Minor
-
2.0.9, 2.1, 2.2.3
-
MOODLE_20_STABLE, MOODLE_21_STABLE, MOODLE_22_STABLE
-
MOODLE_21_STABLE, MOODLE_22_STABLE
-
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.