fix empty collection in PROPFIND/REPORT after last commit caused by creating a reference / NULL value in filter for path-attr/caldav_name

This commit is contained in:
ralf 2023-02-15 08:45:28 +01:00
parent 9fe2914d83
commit 27bd803e84
3 changed files with 16 additions and 10 deletions

View File

@ -244,7 +244,7 @@ class addressbook_groupdav extends Api\CalDAV\Handler
$sync_collection_report = $filter['sync-collection'];
unset($filter['sync-collection']);
if (isset($filter[self::$path_attr]))
if (!empty($filter[self::$path_attr]))
{
if (!is_array($filter[self::$path_attr])) $filter[self::$path_attr] = (array)$filter[self::$path_attr];
$requested_multiget_ids =& $filter[self::$path_attr];
@ -293,7 +293,7 @@ class addressbook_groupdav extends Api\CalDAV\Handler
foreach($contacts as &$contact)
{
// remove contact from requested multiget ids, to be able to report not found urls
if ($requested_multiget_ids && ($k = array_search($contact[self::$path_attr], $requested_multiget_ids)) !== false)
if (!empty($requested_multiget_ids) && ($k = array_search($contact[self::$path_attr], $requested_multiget_ids)) !== false)
{
unset($requested_multiget_ids[$k]);
}
@ -386,7 +386,7 @@ class addressbook_groupdav extends Api\CalDAV\Handler
$files[] = $this->add_resource($path, $list, $props);
// remove list from requested multiget ids, to be able to report not found urls
if ($requested_multiget_ids && ($k = array_search($list[self::$path_attr], $requested_multiget_ids)) !== false)
if (!empty($requested_multiget_ids) && ($k = array_search($list[self::$path_attr], $requested_multiget_ids)) !== false)
{
unset($requested_multiget_ids[$k]);
}
@ -399,7 +399,7 @@ class addressbook_groupdav extends Api\CalDAV\Handler
}
}
// report not found multiget urls
if ($report_not_found_multiget_ids && $requested_multiget_ids)
if ($report_not_found_multiget_ids && !empty($requested_multiget_ids))
{
foreach($requested_multiget_ids as $id)
{

View File

@ -344,7 +344,10 @@ class calendar_groupdav extends Api\CalDAV\Handler
$filter['offset'] = $start[0];
$filter['num_rows'] = $start[1];
}
$requested_multiget_ids =& $filter['query'][self::$path_attr];
if (!empty($filter['query'][self::$path_attr]))
{
$requested_multiget_ids =& $filter['query'][self::$path_attr];
}
$sync_collection = $filter['sync-collection'];
$events =& $this->bo->search($filter);
@ -354,7 +357,7 @@ class calendar_groupdav extends Api\CalDAV\Handler
foreach($events as $event)
{
// remove event from requested multiget ids, to be able to report not found urls
if ($requested_multiget_ids && ($k = array_search($event[self::$path_attr], $requested_multiget_ids)) !== false)
if (!empty($requested_multiget_ids) && ($k = array_search($event[self::$path_attr], $requested_multiget_ids)) !== false)
{
unset($requested_multiget_ids[$k]);
}
@ -407,7 +410,7 @@ class calendar_groupdav extends Api\CalDAV\Handler
}
}
// report not found multiget urls
if ($requested_multiget_ids)
if (!empty($requested_multiget_ids))
{
foreach($requested_multiget_ids as $id)
{

View File

@ -282,7 +282,10 @@ class infolog_groupdav extends Api\CalDAV\Handler
$offset = 0;
}
$requested_multiget_ids =& $filter[self::$path_attr];
if (!empty($filter[self::$path_attr]))
{
$requested_multiget_ids =& $filter[self::$path_attr];
}
$files = array();
// ToDo: add parameter to only return id & etag
@ -292,7 +295,7 @@ class infolog_groupdav extends Api\CalDAV\Handler
foreach($tasks as $task)
{
// remove task from requested multiget ids, to be able to report not found urls
if ($requested_multiget_ids && ($k = array_search($task[self::$path_attr], $requested_multiget_ids)) !== false)
if (!empty($requested_multiget_ids) && ($k = array_search($task[self::$path_attr], $requested_multiget_ids)) !== false)
{
unset($requested_multiget_ids[$k]);
}
@ -320,7 +323,7 @@ class infolog_groupdav extends Api\CalDAV\Handler
}
}
// report not found multiget urls
if ($requested_multiget_ids)
if (!empty($requested_multiget_ids))
{
foreach($requested_multiget_ids as $id)
{