To reproduce the error:
1. View the results of a quiz (node/%node/results/%quiz_rid) which contains a long-answer question and that has already been scored
2. Press the submit button
=> The following PHP notice is displayed on the node/%node/results page:

Notice: Undefined index: warning in _quiz_remove_unscored_message() (line 177 of /Applications/XAMPP/xamppfiles/htdocs/drupal6to7/sites/all/modules/contrib/quiz/quiz.pages.inc).

Explanation:
1. The results page is themed by theme_quiz_admin_summary(), which:
- sets a message in $_SESSION['messages']['warning'] IF the quiz has NOT been evaluated
- outputs the quiz_report_form (drupal_render(drupal_get_form...))
2. The submit function of quiz_report_form calls _quiz_remove_unscored_message().
3. _quiz_remove_unscored_message() searches for the string "This quiz has not been scored yet" in $_SESSION['messages']['warning'], which is not set if the quiz has already been evaluated (hence the "undefined index" notice)

The attached patch changes the quiz_report_form_submit function so that it doesn't call _quiz_remove_unscored_message() when the UPDATE query doesn't affect any row (i.e. db_query(...)->execute() returns 0).

Comments

rombapa’s picture

Status: Needs review » Closed (duplicate)

The attached patch is malformed. Please ignore it and see here instead: http://drupal.org/node/1373898.

rombapa’s picture

Issue summary: View changes

format

rombapa’s picture

Issue summary: View changes

format