-
Bug
-
Resolution: Fixed
-
Minor
-
3.7.1
-
MOODLE_37_STABLE
-
MOODLE_37_STABLE
-
MDL-66336_master -
Steps to reproduce:
- Remove moodle/category:viewcourselist from all roles
- Log in to Moodle
- Navigate to Site Administration > Courses > Manage courses and categories
The error below is displayed:
Notice: Trying to get property of non-object in /blah/course/management.php on line 74 |
|
Can't find data record in database table course_categories.
|
More information about this error |
|
Debug info: SELECT id,parent FROM {course_categories} WHERE id IS NULL
|
[array (
|
)]
|
Error code: invalidrecord
|
|
Stack trace:
|
|
line 1546 of /lib/dml/moodle_database.php: dml_missing_record_exception thrown |
line 1522 of /lib/dml/moodle_database.php: call to moodle_database->get_record_select() |
line 6643 of /lib/accesslib.php: call to moodle_database->get_record() |
line 74 of /course/management.php: call to context_coursecat::instance() |
Without this permission, core_course_category::top()->get_children(); returns an empty array.
69 $course = null; |
70 $courseid = null; |
71 $topchildren = core_course_category::top()->get_children(); |
72 $category = reset($topchildren); |
73 $categoryid = $category ? $category->id : 0; |
74 $context = context_coursecat::instance($category->id); |
75 $url->param('categoryid', $category->id); |
If line 71 returns an empty array, $category will be set to false on line 72. Line 74 uses $category->id, not $categoryid which has been set to 0 in this case. Since $category is false, $category->id does not exist.
- is a regression caused by
-
MDL-10965 Add new capability to view the list of non-hidden courses
-
- Closed
-