If you have a quiz with some quiz page or quiz direction elements in addition to e.g. a long format question that needs feedback, submitting the feedback on a set of results causes a PHP error.
Fatal error: Class name must be a valid object or a string in {...}/sites/all/modules/contrib/quiz/question_types/quiz_question/quiz_question.module on line 647, referer: http://www.sbs.intranet.local/node/6566/quiz/results/68/view
These two 'non-question questions' both have an implementation of getReportForm (see QuizQuestionResponse#getReportForm()) which returns an array with only '#no_report' => TRUE in it. Unfortunately when the feedback on the quiz (e.g. for long answer questions in the same quiz) is submitted, this setting is not checked before trying to load the question based on the nid. The form_state for these questions does not include the nid, so loading them fails and the PHP error occurs.
I have a fix which tests for the existence of the nid field before loading the question, but it may be better to remove those questions from the results form entirely?
Comment | File | Size | Author |
---|---|---|---|
#7 | quiz_pages_and_quiz-2724713-7.patch | 1.39 KB | djdevin |
| |||
#5 | quiz_pages_and_quiz-2724713-5.patch | 1.39 KB | djdevin |
|
Comments
Comment #2
djdevinThere's also QuizQuestion::hasFeedback() which we can use. #report_form is a sort of old artifact from 4.x so maybe we can get rid of that.
It's checked in QuizResultController:buildContent() but maybe what you are describing doesn't use that.
Comment #3
djdevinComment #4
djdevinComment #5
djdevinComment #6
Da_Cloud CreditAttribution: Da_Cloud at INDICIA commentedI've tested the patch #5 in one of my local instances and I can say that it fixes the issue.
Comment #7
djdevinComment #9
djdevin