Protect against infinite recursion in case someone is silly enough to
authorMichael J. Rubinsky <mrubinsk@horde.org>
Mon, 21 Sep 2009 23:58:35 +0000 (19:58 -0400)
committerMichael J. Rubinsky <mrubinsk@horde.org>
Tue, 29 Sep 2009 20:53:57 +0000 (16:53 -0400)
add a resource to one of the resource's own events.

kronolith/lib/Event.php

index 28dd905..d33c460 100644 (file)
@@ -325,6 +325,11 @@ abstract class Kronolith_Event
         $add_events = array();
         foreach ($this->getResources() as $id => $resourceData) {
             $resource = Kronolith::getDriver('Resource')->getResource($id);
+            // Protect against infinite recursion if someone tries to add a
+            // resource to it's own event.
+            if ($resource->get('calendar') == $this->getCalendar()) {
+                continue;
+            }
             $response = $resource->getResponse($this);
             if ($response == Kronolith::RESPONSE_ACCEPTED) {
                 $add_events[] = $resource;