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

Not selecting a matching answer in the Lesson module causes PHP notice.

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Duplicate
    • Affects Version/s: 2.3.4, 2.4
    • Fix Version/s: None
    • Component/s: Lesson
    • Labels:
    • Testing Instructions:
      Hide
      1. Create a lesson activity.
      2. Add a Question page of type 'Matching'.
      3. Fill in a title, description, correct answer response and wrong answer response.
      4. Add to the first 'Answer' field 'Blue is a...'.
      5. Add to the first 'Matches with answer' field 'Colour'.
      6. Add to the second 'Answer' field 'Cold is a...'
      7. Add to the second 'Matches with answer' field 'Temperature'.
      8. Save the question.
      9. Select the 'Preview' icon.
      10. On the next page leave the select boxes at 'Choose...'.
      11. Submit and ensure you get a message telling you to select an option.
      Show
      Create a lesson activity. Add a Question page of type 'Matching'. Fill in a title, description, correct answer response and wrong answer response. Add to the first 'Answer' field 'Blue is a...'. Add to the first 'Matches with answer' field 'Colour'. Add to the second 'Answer' field 'Cold is a...' Add to the second 'Matches with answer' field 'Temperature'. Save the question. Select the 'Preview' icon. On the next page leave the select boxes at 'Choose...'. Submit and ensure you get a message telling you to select an option.
    • Difficulty:
      Easy
    • Affected Branches:
      MOODLE_23_STABLE, MOODLE_24_STABLE

      Description

      If you do not choose an answer, but leave the select box at the option 'Choose...' the following PHP notice displays.

      Notice: Undefined index: in /var/www/mstorage/i24/moodle/mod/lesson/pagetypes/matching.php on line 188
      Notice: Trying to get property of non-object in /var/www/mstorage/i24/moodle/mod/lesson/pagetypes/matching.php on line 188
      

      Replication steps:

      1. Create a lesson activity.
      2. Add a Question page of type 'Matching'.
      3. Fill in a title, description, correct answer response and wrong answer response.
      4. Add to the first 'Answer' field 'Blue is a...'.
      5. Add to the first 'Matches with answer' field 'Colour'.
      6. Add to the second 'Answer' field 'Cold is a...'
      7. Add to the second 'Matches with answer' field 'Temperature'.
      8. Save the question.
      9. Select the 'Preview' icon.
      10. On the next page leave the select boxes at 'Choose...'.
      11. Submit

      Expected result: you get a message telling you to select an option

      Actual result: an error is shown

        Attachments

        1. Screenshot_3_05_13_5_32_PM.png
          88 kB
          Jérôme Mouneyrac
        2. Screenshot_3_05_13_5_32_PM 2.png
          151 kB
          Jérôme Mouneyrac

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: