Moodle
  1. Moodle
  2. MDL-20718

Undefined variable: ispreviewing in in /mod/quiz/review.php

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.9.6
    • Fix Version/s: 1.9.7
    • Component/s: Quiz
    • Labels:
      None
    • Affected Branches:
      MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_19_STABLE
    • Rank:
      26220

      Description

      Create a quiz
      Add at least a question (I added only one multiple choice question)
      Go to preview the quiz
      Push the button "Preview quiz now"
      Provide an answer
      Push the "Submit all and finish"
      Close the java alert message

      What I get WITH DEBUGGER = ALL is:
      Notice: Undefined variable: ispreviewing in moodle19/mod/quiz/review.php on line 127

        Activity

        Hide
        Patrick Pollet added a comment -

        Confirmed
        it should be $isteacher, calculated on line 41 and already used on these lines

        ppollet@prope:~/web/moodle.195/mod/quiz$ grep -Rin isteacher review.php
        41: $isteacher = has_capability('mod/quiz:preview', get_context_instance(CONTEXT_MODULE, $cm->id));
        43: $popup = $isteacher ? 0 : $quiz->popup; // Controls whether this is shown in a javascript-protected window or with a safe browser.
        118: if ($isteacher and $attempt->userid == $USER->id) {
        128: if (!$isteacher && $quiz->popup) {
        157: if ($isteacher and $attempt->userid == $USER->id) {
        169: if (!$isteacher) {
        295: $options->history = ($isteacher and !$attempt->preview) ? 'all' : 'graded';
        307: if (!$isteacher) {

        so

        127 //if (!$ispreviewing && $quiz->popup) {
        128 if (!$isteacher && $quiz->popup) {

        Cheers

        Show
        Patrick Pollet added a comment - Confirmed it should be $isteacher, calculated on line 41 and already used on these lines ppollet@prope:~/web/moodle.195/mod/quiz$ grep -Rin isteacher review.php 41: $isteacher = has_capability('mod/quiz:preview', get_context_instance(CONTEXT_MODULE, $cm->id)); 43: $popup = $isteacher ? 0 : $quiz->popup; // Controls whether this is shown in a javascript-protected window or with a safe browser. 118: if ($isteacher and $attempt->userid == $USER->id) { 128: if (!$isteacher && $quiz->popup) { 157: if ($isteacher and $attempt->userid == $USER->id) { 169: if (!$isteacher) { 295: $options->history = ($isteacher and !$attempt->preview) ? 'all' : 'graded'; 307: if (!$isteacher) { so 127 //if (!$ispreviewing && $quiz->popup) { 128 if (!$isteacher && $quiz->popup) { Cheers
        Hide
        Tim Hunt added a comment -

        Sorry about that. It was a bad back-port of a change from Moodle 2.0. Fixed now.

        Show
        Tim Hunt added a comment - Sorry about that. It was a bad back-port of a change from Moodle 2.0. Fixed now.
        Hide
        Daniele Cordella added a comment -

        thanks!

        Show
        Daniele Cordella added a comment - thanks!
        Hide
        Andrew Davis added a comment -

        The preview quiz now working fine. Closing.

        Show
        Andrew Davis added a comment - The preview quiz now working fine. Closing.

          People

          • Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: