Steps to recreate -
- enable global search on Moodle with all settings left as default
- create a new course "veggies" and a label "cabbage"
- give the course:view permission to "Authenticated users" for "veggies"
- log in as a non-admin user, not registered on any courses
- go into the "veggies" course and search for "cabbage" - no results, as expected, because "searchable courses" is still set to the default of "search within enrolled courses only"
- from the "search within" drop-down menu choose "course: veggies" and search again
Coding error detected, it must be fixed by a programmer: moodle_database::get_in_or_equal() does not accept empty arrays
- line 770 of /lib/dml/moodle_database.php: coding_exception thrown
- line 593 of /search/classes/manager.php: call to moodle_database->get_in_or_equal()
- line 778 of /search/classes/manager.php: call to core_search\manager->get_areas_user_accesses()
- line 684 of /search/classes/manager.php: call to core_search\manager->search()
- line 150 of /search/index.php: call to core_search\manager->paged_search()
The error doesn't occur if you've changed "searchable courses" to "search within all courses the user can access"