From 0b86ba7a209c55d76913f667c1f9fc9a6829ba1b Mon Sep 17 00:00:00 2001 From: ralf Date: Mon, 13 Feb 2023 22:41:57 +0100 Subject: [PATCH] * Addressbook/CardDAV: fix new Thunderbird 110 could not sync big addressbooks TB 110 does an initial PROPFIND and then requests ALL resources in a single multiget REPORT, which caused two problems: a) enabled CalDAV/CardDAV request logging switched output-buffering on and then runs out of memory --> switching it and therefore logging off for multiget REPORTS with more then 200 resources b) PROPFIND iterator wrongly continued running, if the not found resources together with the found ones exceeded the chunk-size of 500 --- addressbook/inc/class.addressbook_groupdav.inc.php | 8 +++++++- api/src/CalDAV/PropfindIterator.php | 6 +++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/addressbook/inc/class.addressbook_groupdav.inc.php b/addressbook/inc/class.addressbook_groupdav.inc.php index 93bb39db69..8b7caaaf46 100644 --- a/addressbook/inc/class.addressbook_groupdav.inc.php +++ b/addressbook/inc/class.addressbook_groupdav.inc.php @@ -248,6 +248,12 @@ class addressbook_groupdav extends Api\CalDAV\Handler { if (!is_array($filter[self::$path_attr])) $filter[self::$path_attr] = (array)$filter[self::$path_attr]; $requested_multiget_ids =& $filter[self::$path_attr]; + + // stop output buffering switched on to log the response, if we should return more than 200 entries + if (ob_get_level() && count($requested_multiget_ids) > 200) + { + ob_end_flush(); + } } $files = array(); @@ -1325,4 +1331,4 @@ class addressbook_groupdav extends Api\CalDAV\Handler ); return $settings; } -} +} \ No newline at end of file diff --git a/api/src/CalDAV/PropfindIterator.php b/api/src/CalDAV/PropfindIterator.php index 5126cbe556..a0917f6d0c 100644 --- a/api/src/CalDAV/PropfindIterator.php +++ b/api/src/CalDAV/PropfindIterator.php @@ -139,8 +139,8 @@ class PropfindIterator implements \Iterator if ($this->debug) error_log(__METHOD__."() returning TRUE"); return true; } - // check if previous query gave less then CHUNK_SIZE entries --> we're done - if ($this->start && count($this->files) < self::CHUNK_SIZE) + // check if previous query gave not equal CHUNK_SIZE entries (or the last one is a not-found entry with just path / count()===1) --> we're done + if ($this->start && (count($this->files) != self::CHUNK_SIZE || count($this->files[self::CHUNK_SIZE-1]) === 1)) { if ($this->debug) error_log(__METHOD__."() returning FALSE (no more entries)"); return false; @@ -183,4 +183,4 @@ class PropfindIterator implements \Iterator if ($this->debug) error_log(__METHOD__."() returning ".array2string(current($this->files) !== false)); return current($this->files) !== false; } -} +} \ No newline at end of file