Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-20718

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

    Details

    • Type: Bug
    • Status: Closed
    • Priority: 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

      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

        Gliffy Diagrams

          Activity

          Hide
          ppollet 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
          ppollet 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
          timhunt Tim Hunt added a comment -

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

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

          thanks!

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

          The preview quiz now working fine. Closing.

          Show
          andyjdavis 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:
                Fix Release Date:
                25/Nov/09