Error from CRM_Event_ICalendar->gCalRedirect "Expected one Event, found 0" for past events
Overview
Since Updateing to 5.52 I have a lot of error messages form CRM_Event_ICalendar->gCalRedirect
Reproduction steps
- open a event in fron view whiche is in the past e.g. https://dmaster.demo.civicrm.org/civicrm/event/info?id=2&reset=1
- click on "Add event to Google Calendar" e.g. https://dmaster.demo.civicrm.org/civicrm/event/ical?gCalendar=1&reset=1&id=2
- Error: "Expected one Event, found 0"Sorry, due to an error, we are unable to fulfill your request at the moment. You may want to contact your administrator or service provider with more details about what action you were performing when this occurred. Expected one Event, found 0"
Expected behaviour
No Error
Environment information
Civicrm 5.52 and dmaster.demo.civicrm.org "5.55.alpha1"
Comments
https://github.com/civicrm/civicrm-core/blob/c6ea0fd94e7a3be5af08fd1ced1135a5084856bb/CRM/Event/ICalendar.php#L47 only returns events in the future if no start and end date is provided
Possible solution: https://github.com/civicrm/civicrm-core/blob/c6ea0fd94e7a3be5af08fd1ced1135a5084856bb/CRM/Event/ICalendar.php#L49 add && count($info) > 1
https://github.com/civicrm/civicrm-core/blob/c6ea0fd94e7a3be5af08fd1ced1135a5084856bb/CRM/Event/ICalendar.php#L104 or just return instead of thrown an error