Skip to content

Commit

Permalink
fixes #847
Browse files Browse the repository at this point in the history
Signed-off-by: Arne Hamann <[email protected]>
  • Loading branch information
tacruc committed Sep 6, 2022
1 parent 7820f97 commit d8057ba
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/Controller/ContactsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,28 +71,28 @@ public function getContacts(): DataResponse {
// if the contact has a geo attibute use it
if (key_exists('GEO', $c)) {
$geo = $c['GEO'];
if (strlen($geo) > 1) {
if (is_string($geo) && strlen($geo) > 1) {
$result[] = [
'FN' => $c['FN'] ?? $this->N2FN($c['N']) ?? '???',
'URI' => $c['URI'],
'UID' => $c['UID'],
'ADR' => '',
'ADRTYPE' => '',
'HAS_PHOTO' => (isset($c['PHOTO']) && $c['PHOTO'] !== null),
'HAS_PHOTO' => (isset($c['PHOTO'])),
'BOOKID' => $c['addressbook-key'],
'BOOKURI' => $addressBookUri,
'GEO' => $geo,
'GROUPS' => $c['CATEGORIES'] ?? null
];
} elseif (count($geo)>0) {
} elseif (is_countable($geo) && count($geo)>0 && is_iterable($geo)) {
foreach ($geo as $g) {
$result[] = [
'FN' => $c['FN'] ?? $this->N2FN($c['N']) ?? '???',
'URI' => $c['URI'],
'UID' => $c['UID'],
'ADR' => '',
'ADRTYPE' => '',
'HAS_PHOTO' => (isset($c['PHOTO']) && $c['PHOTO'] !== null),
'HAS_PHOTO' => (isset($c['PHOTO'])),
'BOOKID' => $c['addressbook-key'],
'BOOKURI' => $addressBookUri,
'GEO' => $g,
Expand Down

0 comments on commit d8057ba

Please sign in to comment.