Avoid recurrence exceptions being copied to exception items recursively. This caused memory leaks when serializing events for caching

This commit is contained in:
Thomas Bruederli 2013-11-06 16:41:01 +01:00
parent b5d7d3d765
commit e02e7cd3f3

View file

@ -163,20 +163,22 @@ class kolab_format_event extends kolab_format_xcal
else if ($status == kolabformat::StatusCancelled) else if ($status == kolabformat::StatusCancelled)
$object['cancelled'] = true; $object['cancelled'] = true;
// this is an exception object
if ($this->obj->recurrenceID()->isValid()) {
$object['thisandfuture'] = $this->obj->thisAndFuture();
}
// read exception event objects // read exception event objects
if (($exceptions = $this->obj->exceptions()) && is_object($exceptions) && $exceptions->size()) { else if (($exceptions = $this->obj->exceptions()) && is_object($exceptions) && $exceptions->size()) {
$recurrence_exceptions = array();
for ($i=0; $i < $exceptions->size(); $i++) { for ($i=0; $i < $exceptions->size(); $i++) {
if (($exobj = $exceptions->get($i))) { if (($exobj = $exceptions->get($i))) {
$exception = new kolab_format_event($exobj); $exception = new kolab_format_event($exobj);
if ($exception->is_valid()) { if ($exception->is_valid()) {
$object['recurrence']['EXCEPTIONS'][] = $this->expand_exception($exception->to_array(), $object); $recurrence_exceptions[] = $this->expand_exception($exception->to_array(), $object);
} }
} }
} }
} $object['recurrence']['EXCEPTIONS'] = $recurrence_exceptions;
// this is an exception object
else if ($this->obj->recurrenceID()->isValid()) {
$object['thisandfuture'] = $this->obj->thisAndFuture();
} }
return $this->data = $object; return $this->data = $object;