-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Based on the UI you're using to populate Greg event data, it's possible to get into a state where Greg where it throws an exception while trying to calculate recurrences. Addressing things on the UI side is something that should happen, but as a last line of defense Greg shouldn't throw fatal errors when presented with malformed data.
Example: If you set up events with a "Once" frequency which indicates that no recurrence should happen, it can be possible to get an event into a state when Greg still thinks it should calculate recurrences.
STR:
- Set up recurring event, including a "recur until" date
- Switch this event to a frequency of "Once" (i.e. no recurrence)
- If Greg attempts to calculate recurrences for this event, the combination of the non-valid "Once" frequency and a previously-set "recur until" date results in Greg throwing a fatal error
See post_to_calendar_series in greg/src/Event.php for a potential place to address this issue.
Expected behavior
Greg shouldn't throw a fatal error in this case
Actual behavior
Fatal error: Uncaught InvalidArgumentException: The FREQ rule part must be one of the following: SECONDLY, MINUTELY, HOURLY, DAILY, WEEKLY, MONTHLY, YEARLY in /code/wp-content/plugins/greg/vendor/rlanvin/php-rrule/src/RRule.php:244
Steps to reproduce behavior
- Set up recurring event, including a "recur until" date
- Switch this event to a frequency of "Once" (i.e. no recurrence)
- If Greg attempts to calculate recurrences for this event, the combination of the non-valid "Once" frequency and a previously-set "recur until" date results in Greg throwing a fatal error