diff options
author | Thomas Bruederli <bruederli@kolabsys.com> | 2013-11-06 15:41:01 (GMT) |
---|---|---|
committer | Thomas Bruederli <bruederli@kolabsys.com> | 2013-11-06 15:41:36 (GMT) |
commit | 5f43d74609c88ac3e383d8b490ad9fd90ef20d49 (patch) | |
tree | c366065ededbe6348b71132d796789fb5cd8bf8c | |
parent | dbc9c6c8d3c4585c469281808a0c276eafcbf359 (diff) | |
download | roundcubemail-plugins-kolab-5f43d74609c88ac3e383d8b490ad9fd90ef20d49.tar.gz |
Avoid recurrence exceptions being copied to exception items recursively. This caused memory leaks when serializing events for caching
-rw-r--r-- | plugins/libkolab/lib/kolab_format_event.php | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/plugins/libkolab/lib/kolab_format_event.php b/plugins/libkolab/lib/kolab_format_event.php index 9be9bdf..6a8c3ae 100644 --- a/plugins/libkolab/lib/kolab_format_event.php +++ b/plugins/libkolab/lib/kolab_format_event.php @@ -163,20 +163,22 @@ class kolab_format_event extends kolab_format_xcal else if ($status == kolabformat::StatusCancelled) $object['cancelled'] = true; + // this is an exception object + if ($this->obj->recurrenceID()->isValid()) { + $object['thisandfuture'] = $this->obj->thisAndFuture(); + } // 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++) { if (($exobj = $exceptions->get($i))) { $exception = new kolab_format_event($exobj); if ($exception->is_valid()) { - $object['recurrence']['EXCEPTIONS'][] = $this->expand_exception($exception->to_array(), $object); + $recurrence_exceptions[] = $this->expand_exception($exception->to_array(), $object); } } } - } - // this is an exception object - else if ($this->obj->recurrenceID()->isValid()) { - $object['thisandfuture'] = $this->obj->thisAndFuture(); + $object['recurrence']['EXCEPTIONS'] = $recurrence_exceptions; } return $this->data = $object; |