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

Error writing to the database when creating certain cloze question

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 2.1, 2.2
    • 2.1.2
    • Questions
    • MySQL
    • MOODLE_21_STABLE, MOODLE_22_STABLE
    • MOODLE_21_STABLE
    • Hide

      1. Create a multianswer (Embedded answer) question. There is an example question text that tests all the options in this comment: http://tracker.moodle.org/browse/MDL-28241?focusedCommentId=121358&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-121358

      2. Check that the 'Decode and verify question text' button on the form works without errors.

      3. Check that saving the question works without errors, both when creating a new question and editing an existing one.

      4. Then preview the newly created question and verify it works properly.

      Show
      1. Create a multianswer (Embedded answer) question. There is an example question text that tests all the options in this comment: http://tracker.moodle.org/browse/MDL-28241?focusedCommentId=121358&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-121358 2. Check that the 'Decode and verify question text' button on the form works without errors. 3. Check that saving the question works without errors, both when creating a new question and editing an existing one. 4. Then preview the newly created question and verify it works properly.

    Description

      To reproduce:

      Create a new cloze question with this simple HTML code:

      <p>Sub-question 1:

      {2:NUMERICAL:=5E-3:1E-4}

      </p>
      <p>Sub-question 2:

      {1:MULTICHOICE:%100%Yes~%0%No}

      </p>

      Then save it. This leads to the error shown in the image attached. As you can see, Moodle code tries to store a character 'Y' in the 'answerformat' field.

      This character is obviously the first one of the word 'Yes' in the multichoice sub-question (if you change the word
      'Yes' to 'Si' then Moodle tries to store an 'S'), so it seems clearly a problem related to parsing code.

      Note that this bug may pass unnoticed if you upgrade from 1.9 or 2.0 to 2.1 because upgrade works fine. Only when you edit/import the question or add new ones (i.e., when parsing HTML code) this bug appears.

      Attachments

        Issue Links

          Activity

            People

              timhunt Tim Hunt
              orestes Orestes Mas
              Tim Hunt Tim Hunt
              Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
              Rajesh Taneja Rajesh Taneja
              Safat Shahin, Tim Hunt, Andrew Lyons, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              19 Vote for this issue
              Watchers:
              22 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                10/Oct/11