Jump to content

Bug in Calendar application


MrFisc

Recommended Posts

The Calendar applications StreamItems extension takes Event ID's from the calendar_event_rsvp table and then immediately tries to load the event based on that ID. If an RSVP exists in that table for an event that no longer exists in the calendar_events table, it will throw an exception. 

Relevant lines of code in applications/calendar/extensions/StreamItems/StreamItems.php:50 (IPS 4.3)

foreach ( \IPS\Db::i()->select( '*', 'calendar_event_rsvp', $where, 'rsvp_date DESC', 10 ) as $rsvp )
{
	$event = \IPS\calendar\Event::load( $rsvp[ 'rsvp_event_id' ] );

This should be trying to catch an OutOfRangeException.

Link to comment
Share on other sites

13 hours ago, MrFisc said:

If an RSVP exists in that table for an event that no longer exists in the calendar_events table, it will throw an exception. 

Unless you're deleting events directly via DB or not using $event->delete(), that won't happen. Related data are deleted when the event is deleted:

	/**
	 * Delete Record
	 *
	 * @return	void
	 */
	public function delete()
	{
		parent::delete();

		\IPS\Db::i()->delete( 'calendar_event_rsvp', array( 'rsvp_event_id=?', $this->id ) );
		\IPS\Db::i()->delete( 'calendar_event_reminders', array( 'reminder_event_id=?', $this->id ) );

		/* We should not delete maps for imported events, because we do not want to reimport them */
		//\IPS\Db::i()->delete( 'calendar_import_map', array( 'import_event_id=?', $this->id ) );
	}

But yes, an extra layer of check is always welcome.

Link to comment
Share on other sites

I think our first question would inevitably be "how are there RSVP records in the database table for events that don't exist". That situation should not happen, and is probably the first issue we'd look to resolve.

Either way, I would encourage you to submit a ticket for support so we can take a look at your site to see if this can be determined.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...