Open ghost opened 3 months ago
thanks for pointing this out, i haven't worked on this plugin in years, but im glad to hear that it is still used :).
are you using it in Moodle 4?
I will implement the quick fix you suggested and release a new version shortly.
Thank you for this plugin and all the work you have put into it. Very beneficial. When exporting quiz questions with a non-standard question format, an error occurs, preventing the export process from completing successfully. I don't know which question formats in the quiz are responsible for this error as we have several different non-standard question types in our quizzes. This error does not seem to occur for example with standard essay or true/false questions.
Steps to Reproduce:
Create a quiz with questions in a non-standard format (exact format unknown). Attempt to export the quiz questions using the printout format. Error Message:
Debug Information:
Temporary Fix:
On our system, a temporary fix has been applied by modifying line 166 of format.php from:
if (count($question->options->answers) > 1) {
to:if ($question->options->answers && count($question->options->answers) > 1) {
Root Cause:
The error occurs because the $question->options->answers variable is null, causing the count() function to throw an error. The temporary fix checks if $question->options->answers is not null before attempting to count its elements.
Recommendation:
A permanent fix should be implemented to handle the case where $question->options->answers is null, ensuring that the export process can complete successfully for all question formats.