From d4fb0e26e21d502046a57c68e6c5931d139d8839 Mon Sep 17 00:00:00 2001 From: Petr Skoda Date: Mon, 31 Jan 2011 22:19:36 +0100 Subject: [PATCH] MDL-25981 make sure cm is defined --- lib/moodlelib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/moodlelib.php b/lib/moodlelib.php index 643af079601..dd78d2400cf 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -2654,7 +2654,7 @@ function require_course_login($courseorid, $autologinguest = true, $cm = NULL, $ global $CFG, $PAGE, $SITE; $issite = (is_object($courseorid) and $courseorid->id == SITEID) or (!is_object($courseorid) and $courseorid == SITEID); - if ($issite && !($cm instanceof cm_info)) { + if ($issite && !empty($cm) && !($cm instanceof cm_info)) { // note: nearly all pages call get_fast_modinfo anyway and it does not make any // db queries so this is not really a performance concern, however it is obviously // better if you use get_fast_modinfo to get the cm before calling this. -- 2.43.0