willianmano / moodle-theme_moove

A Moodle Boost child theme
GNU General Public License v3.0
170 stars 155 forks source link

Course search crashes when displaying course cards #421

Closed stemiwe closed 11 months ago

stemiwe commented 1 year ago

Describe the bug The first time any search is run on the course search (/course/search.php), the site will crash with an exception. Subsequent calls will work, probably because the search results are cached - the error will come back after purging caches.

To Reproduce Steps to reproduce the behavior:

  1. Purge caches
  2. Go to /course/search.php and search for something that will return at least one course

You will get this exception: Exception - Argument 1 passed to course_modinfo::build_course_cache() must be an instance of stdClass, instance of core_course_list_element given, called in [dirroot]/lib/modinfolib.php on line 478

More information about this error

Debug info: Error code: generalexceptionmessage×Dismiss this notification Stack trace: line 636 of /lib/modinfolib.php: TypeError thrown line 478 of /lib/modinfolib.php: call to course_modinfo::build_course_cache() line 436 of /lib/modinfolib.php: call to course_modinfo->__construct() line 2532 of /lib/modinfolib.php: call to course_modinfo::instance() line 1354 of /lib/completionlib.php: call to get_fast_modinfo() line 73 of /completion/classes/progress.php: call to completion_info->get_activities() line 172 of /theme/moove/classes/util/course.php: call to core_completion\progress::get_course_progress_percentage() line 201 of /theme/moove/classes/output/core/course_renderer.php: call to theme_moove\util\course->get_progress() line 172 of /theme/moove/classes/output/core/course_renderer.php: call to theme_moove\output\core\course_renderer->coursecat_coursebox_content() line 118 of /theme/moove/classes/output/core/course_renderer.php: call to theme_moove\output\core\course_renderer->coursecat_coursebox() line 1819 of /course/renderer.php: call to theme_moove\output\core\course_renderer->coursecat_courses() line 111 of /course/search.php: call to core_course_renderer->search_courses()

Screenshots image

Your environment (please complete the following information):

UniWarwickGrahamWilmott commented 11 months ago

We are seeing the same error on Moodle 4.1.4.

willianmano commented 11 months ago

@stemiwe thanks for reply