diff options
author | Arne Hamann <kontakt+github@arne.email> | 2022-10-02 13:04:06 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-02 13:04:06 +0300 |
commit | cea12b32c5d4e264f0504d41a525b4a750ca3577 (patch) | |
tree | 32b884c29e76aa04a79f120697fc50c21fd5f03c | |
parent | d691bec996efd67d78d154d2857b42d794393f41 (diff) | |
parent | d8057ba2ce9eae0665f1e1ddf4a2bc7597f38633 (diff) |
Merge pull request #849 from nextcloud/check-type-contactscontroller
Check types in contacts controller
-rw-r--r-- | lib/Controller/ContactsController.php | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/Controller/ContactsController.php b/lib/Controller/ContactsController.php index 5320c8d8..da6f3cfa 100644 --- a/lib/Controller/ContactsController.php +++ b/lib/Controller/ContactsController.php @@ -71,20 +71,20 @@ class ContactsController extends Controller { // 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']) ?? '???', @@ -92,7 +92,7 @@ class ContactsController extends Controller { '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, |