ethz-let / moodle-qtype_drawing

1 stars 6 forks source link

Handling no background image #5

Closed daniil-berg closed 3 years ago

daniil-berg commented 3 years ago

Hi, the following PHP notices appear when editing an existing drawing form and reviewing a submitted drawing.

Editing:

Notice: Trying to access array offset on value of type null in /MY_MOODLE_PATH/question/type/drawing/edit_drawing_form.php on line 211

Notice: Trying to access array offset on value of type null in /MY_MOODLE_PATH/question/type/drawing/edit_drawing_form.php on line 215

Notice: Trying to access array offset on value of type null in /MY_MOODLE_PATH/question/type/drawing/edit_drawing_form.php on line 218

Reviewing:

Notice: Trying to access array offset on value of type null in /MY_MOODLE_PATH/question/type/drawing/renderer.php on line 147

Notice: Trying to access array offset on value of type null in /MY_MOODLE_PATH/question/type/drawing/renderer.php on line 149

Notice: Trying to access array offset on value of type null in /MY_MOODLE_PATH/question/type/drawing/renderer.php on line 155

Notice: Trying to access array offset on value of type null in /MY_MOODLE_PATH/question/type/drawing/renderer.php on line 251

Notice: Trying to access array offset on value of type null in /MY_MOODLE_PATH/question/type/drawing/renderer.php on line 263

Notice: Trying to access array offset on value of type null in /MY_MOODLE_PATH/question/type/drawing/renderer.php on line 265

Notice: Trying to access array offset on value of type null in /MY_MOODLE_PATH/question/type/drawing/renderer.php on line 272

As far as I can tell, this is due to the $bgimagearray (in the case of edit_drawing_form.php) and $background (in the case of renderer.php) variables not having the expected structure (i.e. being null instead of an array) when no background image was selected.

This might occur in other places, but so far I only noticed it in the two that I mentioned.