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

Undefined variable $course in calendar_event::properties()

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.4
    • Fix Version/s: 3.4.2
    • Component/s: Calendar
    • Labels:
    • Testing Instructions:
      Hide
      1. Login as an admin.
      2. Go to the calendar and press "New event" and create a "Category" "Type of event" in a category that contains courses
      3. Go to one of the courses of that category and follow the link to the calendar (on the left side menu)
      4. Search for the event you just created, hover the event link and take note of the id of that event (If you inspect the link using your browser's dev tools, the event ID is the value in the anchor tag's data-event-id attribute).
      5. Go to calendar/event.php?id=[THE_EVENT_ID]
      6. Save the event.
        • Confirm that you don't see any notice after saving the event.
      Show
      Login as an admin. Go to the calendar and press "New event" and create a "Category" "Type of event" in a category that contains courses Go to one of the courses of that category and follow the link to the calendar (on the left side menu) Search for the event you just created, hover the event link and take note of the id of that event (If you inspect the link using your browser's dev tools, the event ID is the value in the anchor tag's data-event-id attribute). Go to calendar/event.php?id= [THE_EVENT_ID] Save the event. Confirm that you don't see any notice after saving the event.
    • Affected Branches:
      MOODLE_34_STABLE
    • Fixed Branches:
      MOODLE_34_STABLE
    • Pull 3.4 Branch:
    • Pull Master Branch:
      MDL-61152-master

      Description

      The $course variable here is undefined in the case of category event types.

      To reproduce:

      1. Login as an admin.
      2. Create a category event.
      3. Take note of the id of that event (If you inspect the link using your browser's dev tools, the event ID is the value in the anchor tag's data-event-id attribute).
      4. Go to calendar/event.php?id=[THE_EVENT_ID]
      5. Save the event.
      6. Expected: The event will be successfully saved and no notice will be shown.
      7. Actual: The following output is being shown:

         
        Notice: Undefined variable: course in /home/jun/moodles/stable_master/moodle/calendar/lib.php on line 813
         
        Notice: Trying to get property of non-object in /home/jun/moodles/stable_master/moodle/calendar/lib.php on line 813
        Skip to main content
        

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                19/Mar/18