diff --git a/include/api.php b/include/api.php index bb241039a..39a61c983 100644 --- a/include/api.php +++ b/include/api.php @@ -6223,13 +6223,10 @@ function api_friendica_profile_show($type) // select all users from contact table, loop and prepare standard return for user data $users = []; - $nurls = Contact::select(['id', 'nurl'], ['uid' => api_user(), 'profile-id' => $rr['id']]); - - if (DBA::isResult($nurls)) { - foreach ($nurls as $nurl) { - $user = api_get_user($a, $nurl['nurl']); - ($type == "xml") ? $users[$k++ . ":user"] = $user : $users[] = $user; - } + $nurls = Contact::selectToArray(['id', 'nurl'], ['uid' => api_user(), 'profile-id' => $rr['id']]); + foreach ($nurls as $nurl) { + $user = api_get_user($a, $nurl['nurl']); + ($type == "xml") ? $users[$k++ . ":user"] = $user : $users[] = $user; } $profile['users'] = $users; diff --git a/src/Database/Database.php b/src/Database/Database.php index 501d65fe7..a2e31d89b 100644 --- a/src/Database/Database.php +++ b/src/Database/Database.php @@ -1512,16 +1512,18 @@ class Database public function toArray($stmt, $do_close = true) { if (is_bool($stmt)) { - return $stmt; + return []; } $data = []; while ($row = $this->fetch($stmt)) { $data[] = $row; } + if ($do_close) { $this->close($stmt); } + return $data; } diff --git a/src/Model/Attach.php b/src/Model/Attach.php index 758d3ae83..0073a6ed3 100644 --- a/src/Model/Attach.php +++ b/src/Model/Attach.php @@ -44,7 +44,7 @@ class Attach extends BaseObject * @param array $conditions Array of fields for conditions * @param array $params Array of several parameters * - * @return boolean|array + * @return array * * @throws \Exception * @see \Friendica\Database\DBA::selectToArray @@ -55,7 +55,7 @@ class Attach extends BaseObject $fields = self::getFields(); } - $r = DBA::selectToArray('attach', $fields, $conditions, $params); + return DBA::selectToArray('attach', $fields, $conditions, $params); } /** diff --git a/src/Model/Item.php b/src/Model/Item.php index c2bb6c892..28f7b436d 100644 --- a/src/Model/Item.php +++ b/src/Model/Item.php @@ -383,7 +383,7 @@ class Item extends BaseObject $result = self::select($fields, $condition, $params); if (is_bool($result)) { - return $result; + return []; } $data = []; @@ -392,7 +392,7 @@ class Item extends BaseObject } DBA::close($result); - return $data; + return $data; } /**