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

can't use the word null in a question answer

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.7
    • Fix Version/s: 1.7, 1.8
    • Component/s: Questions
    • Labels:
      None
    • Environment:
      IE and FF - but i suspect it's on the server, actually...

      Description

      When you have a question that has the word NULL as a possible answer, it causes weird behaviour.

      This manifested itself first at school with 1.5.4.. where a question in a python class had null as the answer. I think the teacher had imported the test using GIFT, and probably had never previewed it. When one tried to take the test, ti simply wouldn't display. Thru some lengthy trial and error I isolated it down to a question that had blank answers, but for which null would have been one good answer. When i put it in, the question could not save, or saved but led to the error.

      I just tried it in 1.7 and found this:
      When you create a fresh question, putting the word null, without quote, lower-case, it gives this error:
      Column 'answer' cannot be null

      INSERT INTO mdl_question_answers ( QUESTION, ANSWER, FRACTION, FEEDBACK ) VALUES ( 3, null, -1, '' )

      if you continue you go back to the site home page.

      What's peculiar is that with enough going back and forth you can actually get the value to save (i.e. by editing the question after it did not save successfully, so it may be unique to an INSERT situation, while UPDATE may work fine. This theory is further confirmed by the fact that i was able to EDIT a question to include the word null, but when I saved it as a new question, it choked as before.

      This does not seem to apply to upper-case NULL, and is not a problem if the answer is in quotes.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  7/Nov/06