Moodle
  1. Moodle
  2. MDL-24394

Match question type: should be able to use the multilang filter on the answers

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.9.9, 2.0, 2.1.4, 2.2.1
    • Fix Version/s: 2.1.5, 2.2.2
    • Component/s: Questions
    • Labels:
    • Testing Instructions:
      Hide

      0. Make sure you have the multi-lang filter enabled on your site, and applying to Content and headings.

      1. Create a match question and enter the following subquestions and answers:

      • Portugese: PT
      • Chinese: <b class="shouldbestripped">ZH</b>
      • Current lanauage: <span lang="en" class="multilang">EN</span><span lang="cz" class="multilang">CS</span><span lang="fr" class="multilang">FR</span>

      (Feel free to alter that last one so it works in your favourite langauge.)

      2. Save the question and re-edit it. Verify that the <b> tags have been stripped out, but that the third answer has not been damaged.

      3. Preview the question, and verify that it works. That is, you should see three choices like PT, ZH and EN, randomly shuffled, in the drop-down menus.

      Show
      0. Make sure you have the multi-lang filter enabled on your site, and applying to Content and headings. 1. Create a match question and enter the following subquestions and answers: Portugese: PT Chinese: <b class="shouldbestripped">ZH</b> Current lanauage: <span lang="en" class="multilang">EN</span><span lang="cz" class="multilang">CS</span><span lang="fr" class="multilang">FR</span> (Feel free to alter that last one so it works in your favourite langauge.) 2. Save the question and re-edit it. Verify that the <b> tags have been stripped out, but that the third answer has not been damaged. 3. Preview the question, and verify that it works. That is, you should see three choices like PT, ZH and EN, randomly shuffled, in the drop-down menus.
    • Affected Branches:
      MOODLE_19_STABLE, MOODLE_20_STABLE, MOODLE_21_STABLE, MOODLE_22_STABLE
    • Fixed Branches:
      MOODLE_21_STABLE, MOODLE_22_STABLE
    • Pull from Repository:
    • Pull Master Branch:
    • Rank:
      1208

      Description

      Things have changed since this problem was originally reported, but the situation now is:

      1. You should be able to enter match answers that work with the multilang filter, but no other HTML. That is, the answers are PARAM_TEXT. This is currently working.

      2. Questions with multilang syntax in the answers should work. That was broken.

      Original description:

      The in_array() check in line 246 (1.9) / 264 (2.0) of questiontype.php doesn't align with what's added to the array in the next line. I think it's probably fairly rare that people have tags in this field, but it leads to unexpected behavior with some answers added twice or not being treated as equal. I can get the same answer three times in the drop-down menu along with the expected unpredictable grading if I add the following answers (tested with the most recent 2.0):

      <b>a</b>

      <i>a</i>

      a

        Issue Links

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved: