-
Bug
-
Resolution: Fixed
-
Minor
-
3.4.1
-
MOODLE_34_STABLE
-
MOODLE_33_STABLE, MOODLE_34_STABLE
-
MDL-61375_master -
The function chat_prepare_update_events in mod/chat/lib.php (MOODLE_34_STABLE) makes an incorrect assumption that causes an exception in the cron.
Line 497:
$DB->get_field('event', 'id', array('modulename' => 'chat', 'instance' => $chat->id))
This assumes that there will never be 2 separate entries in the event table with the same instance and modulename. This is incorrect. Chat creates a 'chattime' entry for a scheduled chat, and a 'expectcompletionon' entry for expected completion date.
When these both exist, get_field throws an exception.
The comment for the function clearly anticipates this, but the code doesn't.