Skip to content
Snippets Groups Projects
Unverified Commit cb5bb693 authored by Christoph Wurst's avatar Christoph Wurst
Browse files

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: default avatarChristoph Wurst <christoph@winzerhof-wurst.at>
parent 25f8d76f
No related branches found
No related tags found
No related merge requests found
...@@ -28,6 +28,8 @@ namespace OCA\ContactsInteraction\Db; ...@@ -28,6 +28,8 @@ namespace OCA\ContactsInteraction\Db;
use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\IDBConnection; use OCP\IDBConnection;
use OCP\IUser; use OCP\IUser;
use function is_resource;
use function stream_get_contents;
class CardSearchDao { class CardSearchDao {
...@@ -79,12 +81,15 @@ class CardSearchDao { ...@@ -79,12 +81,15 @@ class CardSearchDao {
->andWhere($cardQuery->expr()->in('addressbookid', $cardQuery->createFunction($addressbooksQuery->getSQL()), IQueryBuilder::PARAM_INT_ARRAY)) ->andWhere($cardQuery->expr()->in('addressbookid', $cardQuery->createFunction($addressbooksQuery->getSQL()), IQueryBuilder::PARAM_INT_ARRAY))
->setMaxResults(1); ->setMaxResults(1);
$result = $cardQuery->execute(); $result = $cardQuery->execute();
/** @var string|false $card */ /** @var string|resource|false $card */
$card = $result->fetchColumn(0); $card = $result->fetchColumn(0);
if ($card === false) { if ($card === false) {
return null; return null;
} }
if (is_resource($card)) {
return stream_get_contents($card);
}
return $card; return $card;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment