From c30b152c027c0b0727f8a7f43b5d1a2490653e21 Mon Sep 17 00:00:00 2001 From: "Michael J. Rubinsky" Date: Thu, 12 Nov 2009 15:46:00 -0500 Subject: [PATCH] Need to consistently key events by string, not by integer, otherwise when the results are JSON encoded we may get an object or an array. --- kronolith/lib/Driver/Ical.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/kronolith/lib/Driver/Ical.php b/kronolith/lib/Driver/Ical.php index 9f8440bb5..0719df3a5 100644 --- a/kronolith/lib/Driver/Ical.php +++ b/kronolith/lib/Driver/Ical.php @@ -79,16 +79,14 @@ class Kronolith_Driver_Ical extends Kronolith_Driver $components = $iCal->getComponents(); $events = array(); - $count = count($components); $exceptions = array(); - for ($i = 0; $i < $count; $i++) { - $component = $components[$i]; + foreach ($components as $component) { if ($component->getType() == 'vEvent') { $event = new Kronolith_Event_Ical($this); $event->status = Kronolith::STATUS_FREE; $event->fromiCalendar($component); $event->remoteCal = $this->_calendar; - $event->eventID = $i; + $event->eventID = hash('md5', uniqid(mt_rand(), true)); /* Catch RECURRENCE-ID attributes which mark single recurrence * instances. */ -- 2.11.0