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

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.0
    • Fix Version/s: 2.9.5, 3.0.3
    • Component/s: Calendar
    • Labels:
    • Testing Instructions:
      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.
    • Affected Branches:
      MOODLE_30_STABLE
    • Fixed Branches:
      MOODLE_29_STABLE, MOODLE_30_STABLE
    • Pull Master Branch:
      MDL-53027-master

      Description

      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.)

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                14/Mar/16