MDL-50083 mod_assign: protect code against not set flags
authorEloy Lafuente (stronk7) <stronk7@moodle.org>
Wed, 20 Jan 2016 01:50:15 +0000 (02:50 +0100)
committerEloy Lafuente (stronk7) <stronk7@moodle.org>
Wed, 20 Jan 2016 01:50:15 +0000 (02:50 +0100)
Yes could have used !empty() but for some reason found
the isset() && condition more clear. Tired brain, surely.

mod/assign/locallib.php

index 612d1d0..f353948 100644 (file)
@@ -7205,7 +7205,7 @@ class assign {
 
         $this->update_submission($newsubmission, $userid, false, $this->get_instance()->teamsubmission);
         $flags = $this->get_user_flags($userid, false);
-        if ($flags->locked) {
+        if (isset($flags->locked) && $flags->locked) { // May not exist.
             $this->process_unlock_submission($userid);
         }
         return true;