-
Bug
-
Resolution: Fixed
-
Minor
-
4.0.5
-
MOODLE_400_STABLE
-
MOODLE_400_STABLE, MOODLE_401_STABLE
-
MDL-76536-401 -
-
HQ Sprint 1.2 Moppies
As discovered in this forum thread
Having an invalid value for $CFG->creatornewroleid, either because it was configured for a role which was subsequently deleted, or if manually set in config.php (easiest way to reproduce), causes the following errors during course creation:
Warning
Warning: Undefined array key 123 in /var/www/html/lib/classes/event/role_assigned.php
|
on line 108
|
|
Warning: Undefined array key 123 in /var/www/html/lib/accesslib.php on line 4611
|
Exception
Exception - role_get_name(): Argument #1 ($role) must be of type stdClass, null given, called in [dirroot]/lib/accesslib.php on line 4630
|
|
More information about this error
|
Debug info:
|
Error code: generalexceptionmessage
|
Stack trace:
|
|
line 4464 of /lib/accesslib.php: TypeError thrown
|
line 4630 of /lib/accesslib.php: call to role_get_name()
|
line 109 of /lib/classes/event/role_assigned.php: call to role_fix_names()
|
line 813 of /lib/classes/event/base.php: call to core\event\role_assigned->get_legacy_logdata()
|
line 1629 of /lib/accesslib.php: call to core\event\base->trigger()
|
line 2118 of /lib/enrollib.php: call to role_assign()
|
line 1216 of /lib/enrollib.php: call to enrol_plugin->enrol_user()
|
line 184 of /course/edit.php: call to enrol_try_internal_enrol()
|
Subsequently accessing the course via "Manage course categories and courses" in site administration produces the following warning:
Warning: Undefined array key 123 in /var/www/html/course/classes/management/helper.php on line 120
|
|
Warning: Attempt to read property "localname" on null in /var/www/html/course/classes/management/helper.php on line 120
|
We need to
- Prevent this happening again;
- Clean up invalid role assignment records (because despite the exception, the invalid role assignment record was created)
- has a non-specific relationship to
-
MDL-79781 Error in Courses Pending approval when the default role is deleted
-
- Closed
-
- links to