I've been studying the eventrepeat code and have run across a stanza of code that looks like it might be a bug.

//calculate the day of the week, month, and day of the month for the start date of this sequence
        $BYDAY = (int) gmdate('w', ($repeat_data->event_start - $day_offset));
        $BYMONTH = gmdate('n', ($repeat_data->event_start - $day_offset));
        $BYMONTHDAY = gmdate('j', ($repeat_data->event_start - $day_offset));

        //for weekly repeats, set the BYDAY parameter to the same day of the week as the start date for this sequence
        if ($repeatpattern['repeat_RRULE'][0]['FREQ'] == "WEEKLY") {
          $repeatpattern['repeat_RRULE'][0]['BYDAY'] = array($days_of_week[$BYDAY]);

        //for monthly repeats, set the BYMONTHDAY parameter to the same day of the month as the start date for
        //this sequence
        } elseif ($repeatpattern['repeat_RRULE'][0]['FREQ'] == "MONTHLY") {
          $repeatpattern['repeat_RRULE'][0]['BYMONTHDAY'] = array($BYMONTHDAY);

        //for yearly repeats, set the BYMONTHDAY parameter to the same day of the month as the start date for
        //this sequence, and set the BYMONTH parameter to the same month as the start date for this sequence
        } elseif ($repeatpattern['repeat_RRULE'][0]['FREQ'] == "MONTHLY") {
          $repeatpattern['repeat_RRULE'][0]['BYMONTHDAY'] = array($BYMONTHDAY);
          $repeatpattern['repeat_RRULE'][0]['BYMONTH'] = array($BYMONTH);
        }

The very last elseif() in this statement looks like it should be checking for a 'FREQ' of "YEARLY" rather than "MONTHLY". As it stands, I don't see the final elseif() ever executing, nor does the check against "MONTHLY" match the comments above that block.

This is only from reading, not dragging the code into a debugger. It may not be an issue, but just in case this is unintentional I thought I'd raise the question.

Comments

seanbfuller’s picture

At first glance it looks like you're right. I'll check this out over the weekend.

seanbfuller’s picture

Status: Active » Closed (duplicate)

Patch to fix has been posted as a part of http://drupal.org/node/80026

scott.mclewin’s picture

Status: Closed (duplicate) » Closed (fixed)

Thanks Shawn. I'll close out my issue and leave you with the other one to track down and fix (especially since more users are likely to see this as a problem with yearly repeats not working rather than see it as a typo in code)