diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-11-13 09:10:35 +0100 |
---|---|---|
committer | backportbot[bot] <backportbot[bot]@users.noreply.github.com> | 2020-11-13 18:21:22 +0000 |
commit | a4f6ceb8628cd24acfb99e482132c6d4fb387823 (patch) | |
tree | 346d5cf9aedc27c86952d6d4b76b2958ab7bb3ce | |
parent | 1953fccdc2854d4a69b200fe6652392e0c1fbb88 (diff) | |
download | nextcloud-server-a4f6ceb8628cd24acfb99e482132c6d4fb387823.tar.gz nextcloud-server-a4f6ceb8628cd24acfb99e482132c6d4fb387823.zip |
Convert the card resource to a string if necessary
Apparently the fetched column can be a string or resource. Hence we have
to catch the resource type and convert it to a string.
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
-rw-r--r-- | apps/contactsinteraction/lib/Db/CardSearchDao.php | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/apps/contactsinteraction/lib/Db/CardSearchDao.php b/apps/contactsinteraction/lib/Db/CardSearchDao.php index 391dca60fab..0636829272b 100644 --- a/apps/contactsinteraction/lib/Db/CardSearchDao.php +++ b/apps/contactsinteraction/lib/Db/CardSearchDao.php @@ -28,6 +28,8 @@ namespace OCA\ContactsInteraction\Db; use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\IDBConnection; use OCP\IUser; +use function is_resource; +use function stream_get_contents; class CardSearchDao { @@ -79,12 +81,15 @@ class CardSearchDao { ->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; } |