Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion apps/contactsinteraction/lib/Db/CardSearchDao.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\IDBConnection;
use OCP\IUser;
use function is_resource;
use function stream_get_contents;

class CardSearchDao {

Expand Down Expand Up @@ -79,12 +81,15 @@ public function findExisting(IUser $user,
->andWhere($cardQuery->expr()->in('addressbookid', $cardQuery->createFunction($addressbooksQuery->getSQL()), IQueryBuilder::PARAM_INT_ARRAY))
->setMaxResults(1);
$result = $cardQuery->execute();
/** @var string|false $card */
/** @var string|resource|false $card */
$card = $result->fetchColumn(0);

if ($card === false) {
return null;
}
if (is_resource($card)) {
return stream_get_contents($card);
}

return $card;
}
Expand Down