diff --git a/api/src/Contacts.php b/api/src/Contacts.php index 0d62b55de2..3345d52142 100755 --- a/api/src/Contacts.php +++ b/api/src/Contacts.php @@ -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'])) diff --git a/api/src/Contacts/Sql.php b/api/src/Contacts/Sql.php index 50c7edd81d..7ac0647636 100644 --- a/api/src/Contacts/Sql.php +++ b/api/src/Contacts/Sql.php @@ -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; diff --git a/api/src/Contacts/Storage.php b/api/src/Contacts/Storage.php index fe2b3b4531..8d6366de18 100755 --- a/api/src/Contacts/Storage.php +++ b/api/src/Contacts/Storage.php @@ -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']);