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

calendar_get_events() can't return all events, due to incorrect check for boolean.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • 2.9.5, 3.0.3
    • 3.0
    • Calendar
    • MOODLE_30_STABLE
    • MOODLE_29_STABLE, MOODLE_30_STABLE
    • MDL-53027-master
    • Hide
      1. Create one or more course and/or site events with dates within the coming month.
      2. Drop the attached calendartest.php into your Moodle root and view it in the browser.
      3. Confirm that calendartest.php displays an array containing the event(s).
        • Without the fix, there would be an empty array.
      Show
      Create one or more course and/or site events with dates within the coming month. Drop the attached calendartest.php into your Moodle root and view it in the browser. Confirm that calendartest.php displays an array containing the event(s). Without the fix, there would be an empty array.

      I found that calendar_get_events() (incorrectly) always returns an empty array when all three of the $users, $groups, $courses options are boolean - even when some of them are boolean true - e.g.
      $events = calendar_get_events($startdate, $enddate, false, true, true);

      (I was hoping for some advice on the best way to approach it on https://moodle.org/mod/forum/discuss.php?d=327582, but came to the conclusion that replacing is_bool() with empty() is the better fix.)

            balchd Dave Balch
            balchd Dave Balch
            cameron1729 cameron1729
            Andrew Lyons Andrew Lyons
            Marina Glancy Marina Glancy
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.