Browse files

MDL-39947 mod_forum: Add safety check to variable assignment when cou…

…nting unread posts
  • Loading branch information...
1 parent ae61eea commit 752fb7113d52dfa485e75666806a08cb2efcbc48 @aolley aolley committed May 30, 2013
Showing with 5 additions and 1 deletion.
  1. +5 −1 mod/forum/lib.php
View
6 mod/forum/lib.php
@@ -6741,7 +6741,11 @@ function forum_tp_count_forum_unread_posts($cm, $course) {
$modinfo->groups = groups_get_user_groups($course->id, $USER->id);
}
- $mygroups = $modinfo->groups[$cm->groupingid];
+ if (array_key_exists($cm->groupingid, $modinfo->groups)) {
+ $mygroups = $modinfo->groups[$cm->groupingid];
+ } else {
+ $mygroups = false; // Will be set below
+ }
// add all groups posts
if (empty($mygroups)) {

0 comments on commit 752fb71

Please sign in to comment.