Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When I view the results of a Quiz containing questions of type long_answer I get the following error message:
Notice: Undefined property: LongAnswerResponse::$answer_format in LongAnswerResponse->getFeedbackValues() (regel 310 van /Users/fabianderijk/Sites/dubbelklik/sites/all/modules/contrib/quiz/question_types/long_answer/long_answer.classes.inc).
I've added a check that checks if answer_format exists, if not just use check_plain instead of check_markup. This way the error won't show up. I will upload the patch up next.
Comment | File | Size | Author |
---|---|---|---|
#5 | notice_undefined-2894842-5.patch | 869 bytes | Johan den Hollander |
| |||
#2 | notice_undefined-2894842-2.patch | 967 bytes | fabianderijk |
Comments
Comment #2
fabianderijkComment #3
Johan den Hollander CreditAttribution: Johan den Hollander at Finalist commentedComment #4
Da_Cloud CreditAttribution: Da_Cloud at INDICIA commentedPersonally I would suggest using the following code instead.
'attempt' => check_markup($this->answer, (isset($this->answer_format) ? $this->answer_format : NULL)),
Check_markup already has a fallback functionality should the second parameter be NULL, this will result in the use of the variable "filter_fallback_format". While in most cases this will probably result in the exact same output as a check_plain, it is possible to overwrite this variable at which point the output could be different.
Comment #5
Johan den Hollander CreditAttribution: Johan den Hollander at Finalist commentedUpdated patch to work with the latest dev version.
I used @Da_Cloud's suggestion for this.
Comment #6
djdevin