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?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

martian77 created an issue. See original summary.

djdevin’s picture

There'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.

djdevin’s picture

djdevin’s picture

Version: 7.x-5.0-beta4 » 7.x-5.x-dev
Priority: Normal » Major
djdevin’s picture

Status: Active » Needs review
FileSize
1.39 KB
Da_Cloud’s picture

Status: Needs review » Reviewed & tested by the community

I've tested the patch #5 in one of my local instances and I can say that it fixes the issue.

djdevin’s picture

Status: Reviewed & tested by the community » Needs review
FileSize
1.39 KB

  • djdevin committed 060c506 on 7.x-5.x
    Issue #2724713 by djdevin: Quiz Pages and Quiz Directions cause an error...
djdevin’s picture

Status: Needs review » Fixed
Issue tags: -7.x-5.0 release blocker

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.