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

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

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • 2.3.4, 2.4
    • None
    • Lesson
    • MOODLE_23_STABLE, MOODLE_24_STABLE
    • Easy
    • 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.

    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

        Issue Links

          Activity

            People

              rwijaya Rossiani Wijaya
              markn Mark Nelson
              Ilya Tregubov, Kevin Percy, Mathew May, Mihail Geshoski, Shamim Rezaie
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: