Need to consistently key events by string, not by integer, otherwise
authorMichael J. Rubinsky <mrubinsk@horde.org>
Thu, 12 Nov 2009 20:46:00 +0000 (15:46 -0500)
committerMichael J. Rubinsky <mrubinsk@horde.org>
Thu, 12 Nov 2009 20:46:00 +0000 (15:46 -0500)
when the results are JSON encoded we may get an object or an array.

kronolith/lib/Driver/Ical.php

index 9f8440b..0719df3 100644 (file)
@@ -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. */