-
Bug
-
Resolution: Fixed
-
Blocker
-
2.6.1, 2.7.1
-
MOODLE_26_STABLE, MOODLE_27_STABLE
-
MOODLE_26_STABLE, MOODLE_27_STABLE
-
MDL-44536-master-workshop-complete-report -
If I have a Workshop module in a course and then go to view a "complete report", I get the following error:
Coding error detected, it must be fixed by a programmer: PHP catchable fatal error
More information about this error
Debug info: Argument 2 passed to workshop::__construct() must be an instance of stdClass, instance of cm_info given, called in [dirroot]/mod/workshop/lib.php on line 305 and defined
Error code: codingerror
Stack trace:
line 393 of /lib/setuplib.php: coding_exception thrown
line 190 of /mod/workshop/locallib.php: call to default_error_handler()
line 305 of /mod/workshop/lib.php: call to workshop->__construct()
line 131 of /report/outline/user.php: call to workshop_user_complete()
The complete report is the one found here:
https://MOODLE_URL/report/outline/user.php?id=USERID&course=COURSEID&mode=complete
The error is happening with this line of code in report/outline/user.php:
$user_complete($course, $user, $mod, $instance);
|
Which points to:
function workshop_user_complete($course, $user, $mod, $workshop) {
|
global $CFG, $DB, $OUTPUT;
|
require_once(dirname(__FILE__).'/locallib.php');
|
require_once($CFG->libdir.'/gradelib.php');
|
|
$workshop = new workshop($workshop, $mod, $course);
|
$grades = grade_get_grades($course->id, 'mod', 'workshop', $workshop->id, $user->id);
|
The new workshop line is passing in $mod which is of class cm_info but the constructor function is expecting a stdClass object.
public function __construct(stdclass $dbrecord, stdclass $cm, stdclass $course, stdclass $context=null)
|
I can workaround this for now by using the following band-aid:
$cm = get_coursemodule_from_id('workshop', $mod->id);
|
$workshop = new workshop($workshop, $cm, $course);
|
$grades = grade_get_grades($course->id, 'mod', 'workshop', $workshop->id, $user->id);
|
It appears to work, but I have no idea what bizarre and unpredictable effects it might have, so I am hoping someone with a greater understanding than myself could weigh in.
- Testing discovered
-
MDL-45409 Debug notices when viewing user posts
- Closed