ndunand / moodle-qtype_matrix

Source code of https://moodle.org/plugins/qtype_matrix
2 stars 10 forks source link

Matrix column and row descriptions changed the data structure, but did not fix the used functions #46

Closed danowar2k closed 4 years ago

danowar2k commented 4 years ago

Hi,

I'm getting an error after updating the plugin from 2018050702 (3.5.2) -> 2018050703 (3.5.3).

I think you changed the column/row/feedback/header data structure.

For example, $row->description was a string before but now it is an associative array. Same for column feedback and column descriptions.

$row->description['text'] (string)
$row->description['format'] (int)

This leads to an error in these two places here:

https://github.com/ndunand/moodle-qtype_matrix/blob/99474d601ebb79d1158a79435b112fdb60fa7d4c/renderer.php#L77-L79

https://github.com/ndunand/moodle-qtype_matrix/blob/99474d601ebb79d1158a79435b112fdb60fa7d4c/renderer.php#L95-L97

Because strip_tags expects a string, but not an associative array.

danowar2k commented 4 years ago

An additional bug that surfaces (quite possibly because of this) is that when you create a new question of this type and save it without adding descriptions or feedback, the descriptions and feedback are stored as the following text: "Array".

danowar2k commented 4 years ago

Found the place where the data structure is stored wrong for rows and feedback:

https://github.com/ndunand/moodle-qtype_matrix/blob/99474d601ebb79d1158a79435b112fdb60fa7d4c/libs/question_matrix_store.php#L174-L180