-
Bug
-
Resolution: Fixed
-
Minor
-
2.6.6, 2.8.1
-
MOODLE_26_STABLE, MOODLE_28_STABLE
-
MOODLE_27_STABLE, MOODLE_28_STABLE
-
MDL-48723_master_forum-plagiarism_errors -
function forum_print_attachments is throwing php notices in the cron due to this code in that function:
if (!empty($CFG->enableplagiarism)) {
|
require_once($CFG->libdir.'/plagiarismlib.php');
|
$output .= plagiarism_get_links(array('userid' => $post->userid,
|
'file' => $file,
|
'cmid' => $cm->id,
|
'course' => $post->course,
|
'forum' => $post->forum));
|
$output .= '<br />';
|
}
|
The notices look like this:
PHP Notice: Undefined property: stdClass::$course in /home/moodle/2.6/docs/mod/forum/lib.php on line 4193
|
PHP Notice: Undefined property: stdClass::$forum in /home/moodle/2.6/docs/mod/forum/lib.php on line 4194
|
They occur when forum_print_attachments gets called (through forum_make_mail_text and forum_make_mail_post) from forum_cron while processing the digest mailings. The problem occurs because, for digests, the post object gets created in this line and so does not have the course and forum properties on it:
if ($post = $DB->get_record('forum_posts', array('id' => $digestpost->postid))) {
|
For the non-digest case, the posts come from forum_get_unmailed_posts, which joins with mdl_forum_discussions to bring in the course and forum properties.
We experience the problem in 2.6, but the problem also appears to be present in 2.8, which we will put into production shortly.