Notice: Trying to get property of non-object in quiz_access_results() (line 186

Created on 12 January 2018, about 7 years ago
Updated 25 August 2024, 5 months ago

We had constructed a View listing users, that is used on the admin side of things for a website.

We started to get a lot of notices in the log,
Notice: Trying to get property of non-object in quiz_access_results() (line 186 of .../sites/all/modules/quiz/quiz.module).

After digging through the code, making a change to the quiz_result_access() function in quiz.module fixed the issue

Before:

function quiz_result_access($op, $quiz_result) {
 $quiz = node_load($quiz_result->nid);
  return quiz_access_results($quiz, $quiz_result);
}

After:

function quiz_result_access($op, $quiz_result) {
  if (is_object($quiz_result)) {
    $quiz = node_load($quiz_result->nid);
    return quiz_access_results($quiz, $quiz_result);
  }
  else {
    return FALSE;
  }
}
πŸ› Bug report
Status

Postponed: needs info

Version

5.3

Component

Code - Quiz core

Created by

πŸ‡ΊπŸ‡ΈUnited States markusa

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024