Sticky Notes is a Moodle activity for creating an interactive post-it wall. Students can create, move and vote for notes, under supervision of teacher which can define colors, lock fucntionnalities...
Other
4
stars
6
forks
source link
Undefined variable $data referenced when locking #31
Warning: Trying to access array offset on value of type null in /var/www/site/mod/rstickynotes/note.php on line 101
This is due to a type cast to an object of the $data variable which was not yet previously initialised:
/**
* Updates locks parameters.
* @param object $data Datas from the form
* @return post The id of the activity.
*/
function update_lock($instance, $lock, $lockvalue) {
global $DB;
$data = (object)$data;
$data->id = $instance;
$data->$lock = $lockvalue;
$res = $DB->update_record('stickynotes', $data);
return true;
}
When locking, the following error is received:
This is due to a type cast to an object of the $data variable which was not yet previously initialised: