fix a couple of Undefined array key warnings

This commit is contained in:
Ralf Becker 2021-11-29 16:35:50 +02:00
parent d40a1d992a
commit 0a2488ed99
3 changed files with 5 additions and 5 deletions

View File

@ -764,7 +764,7 @@ class Contacts extends Contacts\Storage
$data[$name] = DateTime::server2user($data[$name], $date_format);
}
}
$data['photo'] = $this->photo_src($data['id'],!empty($data['jpegphoto']) || (($data['files']??0) & self::FILES_BIT_PHOTO), '', $data['etag'] ?? null);
$data['photo'] = $this->photo_src($data['id'] ?? null,!empty($data['jpegphoto']) || (($data['files']??0) & self::FILES_BIT_PHOTO), '', $data['etag'] ?? null);
// set freebusy_uri for accounts
if (empty($data['freebusy_uri']) && empty($data['owner']) && !empty($data['account_id']) && empty($GLOBALS['egw_setup']))

View File

@ -482,13 +482,13 @@ class Sql extends Api\Storage
$owner = isset($filter['owner']) ? $filter['owner'] : (isset($criteria['owner']) ? $criteria['owner'] : null);
// fix cat_id criteria to search in comma-separated multiple cats and return subcats
if (is_array($criteria) && ($cats = $criteria['cat_id']))
if (is_array($criteria) && !empty($criteria['cat_id']))
{
$criteria = array_merge($criteria, $this->_cat_search($criteria['cat_id']));
unset($criteria['cat_id']);
}
// fix cat_id filter to search in comma-separated multiple cats and return subcats
if (($cats = $filter['cat_id']))
if (!empty($filter['cat_id']))
{
if ($filter['cat_id'][0] == '!')
{
@ -680,7 +680,7 @@ class Sql extends Api\Storage
{
$extra_cols[$key] = "$shared_with AS shared_with";
}
switch ((string)$filter['shared_with'])
switch ($filter['shared_with'] ?? '')
{
case '': // filter not set
break;

View File

@ -655,7 +655,7 @@ class Storage
//error_log(__METHOD__.'('.array2string($criteria,true).','.array2string($only_keys).",'$order_by','$extra_cols','$wildcard','$empty','$op',".array2string($start).','.array2string($filter,true).",'$join')");
// Handle 'None' country option
if(is_array($filter) && $filter['adr_one_countrycode'] == '-custom-')
if(is_array($filter) && isset($filter['adr_one_countrycode']) && $filter['adr_one_countrycode'] === '-custom-')
{
$filter[] = 'adr_one_countrycode IS NULL';
unset($filter['adr_one_countrycode']);