fix not working REPORT or PROPFIND

PHP runs out of memory, as bo->search($query) increments $query['start'] itself, so we need to check and break after total is reached
This commit is contained in:
ralf 2023-02-16 09:21:01 +01:00
parent 35efc6bc43
commit 4731128d50

View File

@ -282,6 +282,8 @@ class infolog_groupdav extends Api\CalDAV\Handler
'date_format' => 'server', 'date_format' => 'server',
'col_filter' => $filter, 'col_filter' => $filter,
'custom_fields' => true, // otherwise custom fields get NOT loaded! 'custom_fields' => true, // otherwise custom fields get NOT loaded!
'start' => 0,
'num_rows' => self::CHUNK_SIZE,
); );
$check_responsible = false; $check_responsible = false;
if (substr($task_filter, -8) == '+deleted') if (substr($task_filter, -8) == '+deleted')
@ -297,10 +299,8 @@ class infolog_groupdav extends Api\CalDAV\Handler
$files = array(); $files = array();
// ToDo: add parameter to only return id & etag // ToDo: add parameter to only return id & etag
for($chunk=0; ($params = $query+[ // Please note: $query['start'] get incremented automatically by bo->search() with number of returned rows!
'start' => $chunk*self::CHUNK_SIZE, while(($tasks =& $this->bo->search($query)))
'num_rows' => self::CHUNK_SIZE,
]) && ($tasks =& $this->bo->search($params)); ++$chunk)
{ {
foreach($tasks as $task) foreach($tasks as $task)
{ {
@ -339,6 +339,12 @@ class infolog_groupdav extends Api\CalDAV\Handler
} }
yield $this->add_resource($path, $task, $props); yield $this->add_resource($path, $task, $props);
} }
// Please note: $query['start'] get incremented automatically by bo->search() with number of returned rows!
// --> we need to break here, if start is further then total
if ($query['start'] < $query['total'])
{
break;
}
} }
// report not found multiget urls // report not found multiget urls
if (!empty($this->requested_multiget_ids)) if (!empty($this->requested_multiget_ids))