diff options
author | Aaron Parecki <aaron@parecki.com> | 2016-12-17 15:07:06 -0800 |
---|---|---|
committer | Aaron Parecki <aaron@parecki.com> | 2016-12-17 15:07:06 -0800 |
commit | ccc8284c7b568ce017b1febbda5b46da70eb7459 (patch) | |
tree | e9fb666a2387c33db8c0f77a2a60a2d6069c5a8a | |
parent | e82502db35bfca8bbfb451821d5943b6709f47c7 (diff) |
additional checks for array
fixes #47
-rw-r--r-- | lib/helpers.php | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/helpers.php b/lib/helpers.php index 81ad38b..7876e52 100644 --- a/lib/helpers.php +++ b/lib/helpers.php @@ -240,7 +240,7 @@ function get_micropub_config(&$user, $query=[]) { $targets = []; $r = micropub_get($user->micropub_endpoint, $query, $user->micropub_access_token); - if($r['data'] && array_key_exists('syndicate-to', $r['data'])) { + if($r['data'] && is_array($r['data']) && array_key_exists('syndicate-to', $r['data'])) { if(is_array($r['data']['syndicate-to'])) { $data = $r['data']['syndicate-to']; } else { @@ -248,13 +248,13 @@ function get_micropub_config(&$user, $query=[]) { } foreach($data as $t) { - if(array_key_exists('service', $t) && array_key_exists('photo', $t['service'])) { + if(is_array($t) && array_key_exists('service', $t) && array_key_exists('photo', $t['service'])) { $icon = $t['service']['photo']; } else { $icon = false; } - if(array_key_exists('uid', $t) && array_key_exists('name', $t)) { + if(is_array($t) && array_key_exists('uid', $t) && array_key_exists('name', $t)) { $targets[] = [ 'target' => $t['name'], 'uid' => $t['uid'], |