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

inconsitent constant types in questionlib.php

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.8.8, 1.9.4
    • Fix Version/s: 1.8.9, 1.9.5
    • Component/s: Quiz
    • Labels:
      None
    • Environment:
      any
    • Affected Branches:
      MOODLE_18_STABLE, MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_18_STABLE, MOODLE_19_STABLE

      Description

      The constants in questionlib.php (http://cvs.moodle.org/moodle/lib/questionlib.php?annotate=1.189#l26) are defined as strings.

      However, in questiontype.php (http://cvs.moodle.org/moodle/question/type/questiontype.php?annotate=1.123#l1175) it is expected to be an integer ($state->event is an integer and it's using "!=="). As a result, line 1175 evaluates to true, even though the quiz is over and it should be false. If we don't know what types we will get from the database, then change !== to !=.

        Gliffy Diagrams

          Activity

          Hide
          timhunt Tim Hunt added a comment -

          You are right. Also, I think there is very similar code in the shortanswer question type. I'll check that too, and fix this on Monday.

          (This code has been there for years, well done for being the first person to notice and report the problem!)

          Show
          timhunt Tim Hunt added a comment - You are right. Also, I think there is very similar code in the shortanswer question type. I'll check that too, and fix this on Monday. (This code has been there for years, well done for being the first person to notice and report the problem!)
          Hide
          timhunt Tim Hunt added a comment -

          Thanks Alan, fix checked in.

          Show
          timhunt Tim Hunt added a comment - Thanks Alan, fix checked in.
          Hide
          jerome Jérôme Mouneyrac added a comment -

          Fixed. Thanks Tim for the modification and thanks Alan for spotting the problem.

          Show
          jerome Jérôme Mouneyrac added a comment - Fixed. Thanks Tim for the modification and thanks Alan for spotting the problem.

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                13/May/09