If you compare this code you are seeing with the original (https://github.com/moodle/moodle/blob/MOODLE_35_STABLE/mod/quiz/processattempt.php) then clearly someone has been making local customisations to your code, and clearly they have made a mistake while doing so. (Perhaps they have not considered the case where $nextmod does not exist???)
Quiz
Quiz error
Це обговорення заблоковано, тому ви більше не можете на нього відповідати.