diff --git a/apps/contactsinteraction/lib/Db/RecentContactMapper.php b/apps/contactsinteraction/lib/Db/RecentContactMapper.php index 25a96aaa01e..12af1cbd9e3 100644 --- a/apps/contactsinteraction/lib/Db/RecentContactMapper.php +++ b/apps/contactsinteraction/lib/Db/RecentContactMapper.php @@ -94,7 +94,7 @@ class RecentContactMapper extends QBMapper { ->setMaxResults(1); $cursor = $select->executeQuery(); - $row = $cursor->fetch(); + $row = $cursor->fetchAssociative(); if ($row === false) { return null; diff --git a/apps/contactsinteraction/lib/Migration/FixVcardCategory.php b/apps/contactsinteraction/lib/Migration/FixVcardCategory.php index b2b7ca9fbf5..80e37249a4b 100644 --- a/apps/contactsinteraction/lib/Migration/FixVcardCategory.php +++ b/apps/contactsinteraction/lib/Migration/FixVcardCategory.php @@ -53,7 +53,7 @@ class FixVcardCategory implements IRepairStep { ->set('card', $query->createParameter('card')) ->where($query->expr()->eq('id', $query->createParameter('id'))); - while ($card = $cardsWithTranslatedCategory->fetch()) { + while ($card = $cardsWithTranslatedCategory->fetchAssociative()) { $output->advance(1); try { diff --git a/apps/dav/lib/BackgroundJob/BuildReminderIndexBackgroundJob.php b/apps/dav/lib/BackgroundJob/BuildReminderIndexBackgroundJob.php index 1165367c33f..974c7cd3239 100644 --- a/apps/dav/lib/BackgroundJob/BuildReminderIndexBackgroundJob.php +++ b/apps/dav/lib/BackgroundJob/BuildReminderIndexBackgroundJob.php @@ -74,7 +74,7 @@ class BuildReminderIndexBackgroundJob extends QueuedJob { ->orderBy('id', 'ASC'); $result = $query->executeQuery(); - while ($row = $result->fetch(\PDO::FETCH_ASSOC)) { + while ($row = $result->fetchAssociative()) { $offset = (int)$row['id']; if (is_resource($row['calendardata'])) { $row['calendardata'] = stream_get_contents($row['calendardata']); diff --git a/apps/dav/lib/BackgroundJob/CleanupOrphanedChildrenJob.php b/apps/dav/lib/BackgroundJob/CleanupOrphanedChildrenJob.php index 8a5e34381a7..0f574df084f 100644 --- a/apps/dav/lib/BackgroundJob/CleanupOrphanedChildrenJob.php +++ b/apps/dav/lib/BackgroundJob/CleanupOrphanedChildrenJob.php @@ -72,7 +72,7 @@ class CleanupOrphanedChildrenJob extends QueuedJob { } $result = $selectQb->executeQuery(); - $rows = $result->fetchAll(); + $rows = $result->fetchAllAssociative(); $result->closeCursor(); if (empty($rows)) { return 0; diff --git a/apps/dav/lib/CalDAV/CalDavBackend.php b/apps/dav/lib/CalDAV/CalDavBackend.php index 2299db2a239..8d90df16dbd 100644 --- a/apps/dav/lib/CalDAV/CalDavBackend.php +++ b/apps/dav/lib/CalDAV/CalDavBackend.php @@ -283,7 +283,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription ->andWhere($qb->expr()->lt('deleted_at', $qb->createNamedParameter($deletedBefore))); $result = $qb->executeQuery(); $calendars = []; - while (($row = $result->fetch()) !== false) { + while (($row = $result->fetchAssociative()) !== false) { $calendars[] = [ 'id' => (int)$row['id'], 'deleted_at' => (int)$row['deleted_at'], @@ -345,7 +345,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription $result = $query->executeQuery(); $calendars = []; - while ($row = $result->fetch()) { + while ($row = $result->fetchAssociative()) { $row['principaluri'] = (string)$row['principaluri']; $components = []; if ($row['components']) { @@ -408,7 +408,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription $results = $select->executeQuery(); $readOnlyPropertyName = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only'; - while ($row = $results->fetch()) { + while ($row = $results->fetchAssociative()) { $row['principaluri'] = (string)$row['principaluri']; if ($row['principaluri'] === $principalUri) { continue; @@ -478,7 +478,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription ->orderBy('calendarorder', 'ASC'); $stmt = $query->executeQuery(); $calendars = []; - while ($row = $stmt->fetch()) { + while ($row = $stmt->fetchAssociative()) { $row['principaluri'] = (string)$row['principaluri']; $components = []; if ($row['components']) { @@ -528,7 +528,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription ->andWhere($query->expr()->eq('s.type', $query->createNamedParameter('calendar'))) ->executeQuery(); - while ($row = $result->fetch()) { + while ($row = $result->fetchAssociative()) { $row['principaluri'] = (string)$row['principaluri']; [, $name] = Uri\split($row['principaluri']); $row['displayname'] = $row['displayname'] . "($name)"; @@ -586,7 +586,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription ->andWhere($query->expr()->eq('s.publicuri', $query->createNamedParameter($uri))) ->executeQuery(); - $row = $result->fetch(); + $row = $result->fetchAssociative(); $result->closeCursor(); @@ -643,7 +643,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription ->setMaxResults(1); $stmt = $query->executeQuery(); - $row = $stmt->fetch(); + $row = $stmt->fetchAssociative(); $stmt->closeCursor(); if ($row === false) { return null; @@ -692,7 +692,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription ->setMaxResults(1); $stmt = $query->executeQuery(); - $row = $stmt->fetch(); + $row = $stmt->fetchAssociative(); $stmt->closeCursor(); if ($row === false) { return null; @@ -740,7 +740,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription ->orderBy('calendarorder', 'asc'); $stmt = $query->executeQuery(); - $row = $stmt->fetch(); + $row = $stmt->fetchAssociative(); $stmt->closeCursor(); if ($row === false) { return null; @@ -777,7 +777,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription ->setMaxResults(1); $stmt = $query->executeQuery(); - $row = $stmt->fetch(); + $row = $stmt->fetchAssociative(); $stmt->closeCursor(); if ($row === false) { return null; @@ -1044,7 +1044,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription $rs = $qb->executeQuery(); // iterate through results try { - while (($row = $rs->fetch()) !== false) { + while (($row = $rs->fetchAssociative()) !== false) { yield $row; } } finally { @@ -1076,7 +1076,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription $stmt = $query->executeQuery(); $result = []; - while (($row = $stmt->fetch()) !== false) { + while (($row = $stmt->fetchAssociative()) !== false) { $result[$row['uid']] = [ 'id' => $row['id'], 'etag' => $row['etag'], @@ -1141,7 +1141,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription $stmt = $query->executeQuery(); $result = []; - while (($row = $stmt->fetch()) !== false) { + while (($row = $stmt->fetchAssociative()) !== false) { $result[] = [ 'id' => $row['id'], 'uri' => $row['uri'], @@ -1168,7 +1168,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription $stmt = $query->executeQuery(); $result = []; - while (($row = $stmt->fetch()) !== false) { + while (($row = $stmt->fetchAssociative()) !== false) { $result[] = [ 'id' => $row['id'], 'uri' => $row['uri'], @@ -1207,7 +1207,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription $stmt = $query->executeQuery(); $result = []; - while ($row = $stmt->fetch()) { + while ($row = $stmt->fetchAssociative()) { $result[] = [ 'id' => $row['id'], 'uri' => $row['uri'], @@ -1255,7 +1255,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription ->andWhere($query->expr()->eq('uri', $query->createNamedParameter($objectUri))) ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter($calendarType))); $stmt = $query->executeQuery(); - $row = $stmt->fetch(); + $row = $stmt->fetchAssociative(); $stmt->closeCursor(); if (!$row) { @@ -1316,7 +1316,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription $query->setParameter('uri', $uris, IQueryBuilder::PARAM_STR_ARRAY); $result = $query->executeQuery(); - while ($row = $result->fetch()) { + while ($row = $result->fetchAssociative()) { $objects[] = [ 'id' => $row['id'], 'uri' => $row['uri'], @@ -1383,7 +1383,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription ->andWhere($qbDel->expr()->eq('calendartype', $qbDel->createNamedParameter($calendarType))) ->andWhere($qbDel->expr()->isNotNull('deleted_at')); $result = $qbDel->executeQuery(); - $found = $result->fetch(); + $found = $result->fetchAssociative(); $result->closeCursor(); if ($found !== false) { // the object existed previously but has been deleted @@ -1675,7 +1675,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription ->from('calendarobjects') ->where($qb2->expr()->eq('id', $qb2->createNamedParameter($id, IQueryBuilder::PARAM_INT), IQueryBuilder::PARAM_INT)); $result = $selectObject->executeQuery(); - $row = $result->fetch(); + $row = $result->fetchAssociative(); $result->closeCursor(); if ($row === false) { // Welp, this should possibly not have happened, but let's ignore @@ -1798,7 +1798,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription $stmt = $query->executeQuery(); $result = []; - while ($row = $stmt->fetch()) { + while ($row = $stmt->fetchAssociative()) { // if we leave it as a blob we can't read it both from the post filter and the rowToCalendarObject if (isset($row['calendardata'])) { $row['calendardata'] = $this->readBlob($row['calendardata']); @@ -1958,7 +1958,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription $stmt = $query->executeQuery(); $result = []; - while ($row = $stmt->fetch()) { + while ($row = $stmt->fetchAssociative()) { $path = $uriMapper[$row['calendarid']] . '/' . $row['uri']; if (!in_array($path, $result)) { $result[] = $path; @@ -2171,7 +2171,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription $result = $query->executeQuery(); - while (($row = $result->fetch()) !== false) { + while (($row = $result->fetchAssociative()) !== false) { if ($filterByTimeRange === false) { // No filter required $calendarObjects[] = $row; @@ -2399,7 +2399,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription $result = $calendarObjectIdQuery->executeQuery(); $matches = []; - while (($row = $result->fetch()) !== false) { + while (($row = $result->fetchAssociative()) !== false) { $matches[] = (int)$row['objectid']; } $result->closeCursor(); @@ -2411,7 +2411,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription $result = $query->executeQuery(); $calendarObjects = []; - while (($array = $result->fetch()) !== false) { + while (($array = $result->fetchAssociative()) !== false) { $array['calendarid'] = (int)$array['calendarid']; $array['calendartype'] = (int)$array['calendartype']; $array['calendardata'] = $this->readBlob($array['calendardata']); @@ -2456,7 +2456,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription } $stmt = $query->executeQuery(); - $row = $stmt->fetch(); + $row = $stmt->fetchAssociative(); $stmt->closeCursor(); if ($row) { return $row['calendaruri'] . '/' . $row['objecturi']; @@ -2474,7 +2474,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription ->where($query->expr()->eq('c.principaluri', $query->createNamedParameter($principalUri))) ->andWhere($query->expr()->eq('co.id', $query->createNamedParameter($id, IQueryBuilder::PARAM_INT), IQueryBuilder::PARAM_INT)); $stmt = $query->executeQuery(); - $row = $stmt->fetch(); + $row = $stmt->fetchAssociative(); $stmt->closeCursor(); if (!$row) { @@ -2600,11 +2600,11 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription $result = ['syncToken' => $currentToken, 'added' => [], 'modified' => [], 'deleted' => []]; // retrieve results if ($initialSync) { - $result['added'] = $stmt->fetchAll(\PDO::FETCH_COLUMN); + $result['added'] = $stmt->fetchFirstColumn(); } else { // \PDO::FETCH_NUM is needed due to the inconsistent field names // produced by doctrine for MAX() with different databases - while ($entry = $stmt->fetch(\PDO::FETCH_NUM)) { + while ($entry = $stmt->fetchNumeric()) { // assign uri (column 0) to appropriate mutation based on operation (column 1) // forced (int) is needed as doctrine with OCI returns the operation field as string not integer match ((int)$entry[1]) { @@ -2670,7 +2670,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription $stmt = $query->executeQuery(); $subscriptions = []; - while ($row = $stmt->fetch()) { + while ($row = $stmt->fetchAssociative()) { $subscription = [ 'id' => $row['id'], 'uri' => $row['uri'], @@ -2855,7 +2855,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription ->andWhere($query->expr()->eq('uri', $query->createNamedParameter($objectUri))) ->executeQuery(); - $row = $stmt->fetch(); + $row = $stmt->fetchAssociative(); if (!$row) { return null; @@ -2889,7 +2889,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription ->executeQuery(); $results = []; - while (($row = $stmt->fetch()) !== false) { + while (($row = $stmt->fetchAssociative()) !== false) { $results[] = [ 'calendardata' => $row['calendardata'], 'uri' => $row['uri'], @@ -2939,7 +2939,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription } $ids = array_map(static function (array $id) { return (int)$id[0]; - }, $result->fetchAll(\PDO::FETCH_NUM)); + }, $result->fetchAllNumeric()); $result->closeCursor(); $numDeleted = 0; @@ -3040,7 +3040,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription ) ); $resultAdded = $qbAdded->executeQuery(); - $addedUris = $resultAdded->fetchAll(\PDO::FETCH_COLUMN); + $addedUris = $resultAdded->fetchFirstColumn(); $resultAdded->closeCursor(); // Track everything as changed // Tracking the creation is not necessary because \OCA\DAV\CalDAV\CalDavBackend::getChangesForCalendar @@ -3060,7 +3060,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription $resultDeleted = $qbDeleted->executeQuery(); $deletedUris = array_map(function (string $uri) { return str_replace('-deleted.ics', '.ics', $uri); - }, $resultDeleted->fetchAll(\PDO::FETCH_COLUMN)); + }, $resultDeleted->fetchFirstColumn()); $resultDeleted->closeCursor(); $this->addChanges($calendarId, $deletedUris, 3, $calendarType); }, $this->db); @@ -3306,7 +3306,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription ->executeQuery(); $hasPublishStatuses = []; - while ($row = $result->fetch()) { + while ($row = $result->fetchAssociative()) { $this->publishStatusCache->set((string)$row['resourceid'], $row['publicuri']); $hasPublishStatuses[(int)$row['resourceid']] = true; } @@ -3419,7 +3419,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription ->where($query->expr()->eq('uri', $query->createNamedParameter(BirthdayService::BIRTHDAY_CALENDAR_URI))) ->executeQuery(); - while (($row = $result->fetch()) !== false) { + while (($row = $result->fetchAssociative()) !== false) { $this->deleteCalendar( $row['id'], true // No data to keep in the trashbin, if the user re-enables then we regenerate @@ -3442,7 +3442,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription $stmt = $query->executeQuery(); $uris = []; - while (($row = $stmt->fetch()) !== false) { + while (($row = $stmt->fetchAssociative()) !== false) { $uris[] = $row['uri']; } $stmt->closeCursor(); @@ -3568,7 +3568,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter($calendarType))); $result = $query->executeQuery(); - $objectIds = $result->fetch(); + $objectIds = $result->fetchAssociative(); $result->closeCursor(); if (!isset($objectIds['id'])) { @@ -3713,7 +3713,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription $cmd->select('uid') ->from($this->dbObjectsTable) ->where($cmd->expr()->eq('calendarid', $cmd->createNamedParameter($calendarId))); - $allIds = $cmd->executeQuery()->fetchAll(\PDO::FETCH_COLUMN); + $allIds = $cmd->executeQuery()->fetchFirstColumn(); // delete all links that match object uid's $cmd = $this->db->getQueryBuilder(); $cmd->delete($this->dbObjectInvitationsTable) diff --git a/apps/dav/lib/CalDAV/Federation/FederatedCalendarMapper.php b/apps/dav/lib/CalDAV/Federation/FederatedCalendarMapper.php index 00fa8e659de..4a8103a0865 100644 --- a/apps/dav/lib/CalDAV/Federation/FederatedCalendarMapper.php +++ b/apps/dav/lib/CalDAV/Federation/FederatedCalendarMapper.php @@ -148,7 +148,7 @@ class FederatedCalendarMapper extends QBMapper { ->from(self::TABLE_NAME); $result = $qb->executeQuery(); - while ($row = $result->fetch()) { + while ($row = $result->fetchAssociative()) { yield $this->mapRowToEntity($row); } $result->closeCursor(); diff --git a/apps/dav/lib/CalDAV/Reminder/Backend.php b/apps/dav/lib/CalDAV/Reminder/Backend.php index 329af3a2f56..eca7081928e 100644 --- a/apps/dav/lib/CalDAV/Reminder/Backend.php +++ b/apps/dav/lib/CalDAV/Reminder/Backend.php @@ -48,7 +48,7 @@ class Backend { return array_map( [$this, 'fixRowTyping'], - $stmt->fetchAll() + $stmt->fetchAllAssociative() ); } @@ -67,7 +67,7 @@ class Backend { return array_map( [$this, 'fixRowTyping'], - $stmt->fetchAll() + $stmt->fetchAllAssociative() ); } diff --git a/apps/dav/lib/CalDAV/ResourceBooking/AbstractPrincipalBackend.php b/apps/dav/lib/CalDAV/ResourceBooking/AbstractPrincipalBackend.php index 0ddd83b6e0d..fa3ee937f22 100644 --- a/apps/dav/lib/CalDAV/ResourceBooking/AbstractPrincipalBackend.php +++ b/apps/dav/lib/CalDAV/ResourceBooking/AbstractPrincipalBackend.php @@ -78,7 +78,7 @@ abstract class AbstractPrincipalBackend implements BackendInterface { $metaDataQuery->select([$this->dbForeignKeyName, 'key', 'value']) ->from($this->dbMetaDataTableName); $metaDataStmt = $metaDataQuery->executeQuery(); - $metaDataRows = $metaDataStmt->fetchAll(\PDO::FETCH_ASSOC); + $metaDataRows = $metaDataStmt->fetchAllAssociative(); $metaDataById = []; foreach ($metaDataRows as $metaDataRow) { @@ -90,7 +90,7 @@ abstract class AbstractPrincipalBackend implements BackendInterface { = $metaDataRow['value']; } - while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { + while ($row = $stmt->fetchAssociative()) { $id = $row['id']; if (isset($metaDataById[$id])) { @@ -129,7 +129,7 @@ abstract class AbstractPrincipalBackend implements BackendInterface { ->where($query->expr()->eq('backend_id', $query->createNamedParameter($backendId))) ->andWhere($query->expr()->eq('resource_id', $query->createNamedParameter($resourceId))); $stmt = $query->executeQuery(); - $row = $stmt->fetch(\PDO::FETCH_ASSOC); + $row = $stmt->fetchAssociative(); if (!$row) { return null; @@ -140,7 +140,7 @@ abstract class AbstractPrincipalBackend implements BackendInterface { ->from($this->dbMetaDataTableName) ->where($metaDataQuery->expr()->eq($this->dbForeignKeyName, $metaDataQuery->createNamedParameter($row['id']))); $metaDataStmt = $metaDataQuery->executeQuery(); - $metaDataRows = $metaDataStmt->fetchAll(\PDO::FETCH_ASSOC); + $metaDataRows = $metaDataStmt->fetchAllAssociative(); $metadata = []; foreach ($metaDataRows as $metaDataRow) { @@ -160,7 +160,7 @@ abstract class AbstractPrincipalBackend implements BackendInterface { ->from($this->dbTableName) ->where($query->expr()->eq('id', $query->createNamedParameter($id))); $stmt = $query->executeQuery(); - $row = $stmt->fetch(\PDO::FETCH_ASSOC); + $row = $stmt->fetchAssociative(); if (!$row) { return null; @@ -171,7 +171,7 @@ abstract class AbstractPrincipalBackend implements BackendInterface { ->from($this->dbMetaDataTableName) ->where($metaDataQuery->expr()->eq($this->dbForeignKeyName, $metaDataQuery->createNamedParameter($row['id']))); $metaDataStmt = $metaDataQuery->executeQuery(); - $metaDataRows = $metaDataStmt->fetchAll(\PDO::FETCH_ASSOC); + $metaDataRows = $metaDataStmt->fetchAllAssociative(); $metadata = []; foreach ($metaDataRows as $metaDataRow) { @@ -221,7 +221,7 @@ abstract class AbstractPrincipalBackend implements BackendInterface { $stmt = $query->executeQuery(); $principals = []; - while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { + while ($row = $stmt->fetchAssociative()) { if (!$this->isAllowedToAccessResource($row, $usersGroups)) { continue; } @@ -240,7 +240,7 @@ abstract class AbstractPrincipalBackend implements BackendInterface { $stmt = $query->executeQuery(); $principals = []; - while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { + while ($row = $stmt->fetchAssociative()) { if (!$this->isAllowedToAccessResource($row, $usersGroups)) { continue; } @@ -366,7 +366,7 @@ abstract class AbstractPrincipalBackend implements BackendInterface { } $rows = []; - while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { + while ($row = $stmt->fetchAssociative()) { $principalRow = $this->getPrincipalById($row[$this->dbForeignKeyName]); if (!$principalRow) { continue; @@ -407,7 +407,7 @@ abstract class AbstractPrincipalBackend implements BackendInterface { ->where($query->expr()->eq('email', $query->createNamedParameter($email))); $stmt = $query->executeQuery(); - $row = $stmt->fetch(\PDO::FETCH_ASSOC); + $row = $stmt->fetchAssociative(); if (!$row) { return null; @@ -434,7 +434,7 @@ abstract class AbstractPrincipalBackend implements BackendInterface { ->where($query->expr()->eq('backend_id', $query->createNamedParameter($backendId))) ->andWhere($query->expr()->eq('resource_id', $query->createNamedParameter($resourceId))); $stmt = $query->executeQuery(); - $row = $stmt->fetch(\PDO::FETCH_ASSOC); + $row = $stmt->fetchAssociative(); if (!$row) { return null; diff --git a/apps/dav/lib/CardDAV/CardDavBackend.php b/apps/dav/lib/CardDAV/CardDavBackend.php index 4829bdf4e76..0ca82200735 100644 --- a/apps/dav/lib/CardDAV/CardDavBackend.php +++ b/apps/dav/lib/CardDAV/CardDavBackend.php @@ -26,7 +26,6 @@ use OCP\EventDispatcher\IEventDispatcher; use OCP\IConfig; use OCP\IDBConnection; use OCP\IUserManager; -use PDO; use Sabre\CardDAV\Backend\BackendInterface; use Sabre\CardDAV\Backend\SyncSupport; use Sabre\CardDAV\Plugin; @@ -112,7 +111,7 @@ class CardDavBackend implements BackendInterface, SyncSupport { $addressBooks = []; $result = $select->executeQuery(); - while ($row = $result->fetch()) { + while ($row = $result->fetchAssociative()) { $addressBooks[$row['id']] = [ 'id' => $row['id'], 'uri' => $row['uri'], @@ -150,7 +149,7 @@ class CardDavBackend implements BackendInterface, SyncSupport { $result = $select->executeQuery(); $readOnlyPropertyName = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only'; - while ($row = $result->fetch()) { + while ($row = $result->fetchAssociative()) { if ($row['principaluri'] === $principalUri) { continue; } @@ -202,7 +201,7 @@ class CardDavBackend implements BackendInterface, SyncSupport { $addressBooks = []; $result = $query->executeQuery(); - while ($row = $result->fetch()) { + while ($row = $result->fetchAssociative()) { $addressBooks[$row['id']] = [ 'id' => $row['id'], 'uri' => $row['uri'], @@ -229,7 +228,7 @@ class CardDavBackend implements BackendInterface, SyncSupport { ->from('addressbooks') ->where($query->expr()->eq('id', $query->createNamedParameter($addressBookId, IQueryBuilder::PARAM_INT))) ->executeQuery(); - $row = $result->fetch(); + $row = $result->fetchAssociative(); $result->closeCursor(); if (!$row) { return null; @@ -259,7 +258,7 @@ class CardDavBackend implements BackendInterface, SyncSupport { ->setMaxResults(1) ->executeQuery(); - $row = $result->fetch(); + $row = $result->fetchAssociative(); $result->closeCursor(); if ($row === false) { return null; @@ -482,7 +481,7 @@ class CardDavBackend implements BackendInterface, SyncSupport { $cards = []; $result = $query->executeQuery(); - while ($row = $result->fetch()) { + while ($row = $result->fetchAssociative()) { $row['etag'] = '"' . $row['etag'] . '"'; $modified = false; @@ -519,7 +518,7 @@ class CardDavBackend implements BackendInterface, SyncSupport { ->setMaxResults(1); $result = $query->executeQuery(); - $row = $result->fetch(); + $row = $result->fetchAssociative(); if (!$row) { return false; } @@ -564,7 +563,7 @@ class CardDavBackend implements BackendInterface, SyncSupport { $query->setParameter('uri', $uris, IQueryBuilder::PARAM_STR_ARRAY); $result = $query->executeQuery(); - while ($row = $result->fetch()) { + while ($row = $result->fetchAssociative()) { $row['etag'] = '"' . $row['etag'] . '"'; $modified = false; @@ -891,7 +890,7 @@ class CardDavBackend implements BackendInterface, SyncSupport { )->orderBy('id') ->setMaxResults($limit); $stmt = $qb->executeQuery(); - $values = $stmt->fetchAll(\PDO::FETCH_ASSOC); + $values = $stmt->fetchAllAssociative(); $stmt->closeCursor(); if (count($values) === 0) { $result['syncToken'] = $initialSyncToken; @@ -928,7 +927,7 @@ class CardDavBackend implements BackendInterface, SyncSupport { // This loop ensures that any duplicates are overwritten, only the // last change on a node is relevant. - while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { + while ($row = $stmt->fetchAssociative()) { $changes[$row['uri']] = $row['operation']; $highestSyncToken = $row['synctoken']; } @@ -977,7 +976,7 @@ class CardDavBackend implements BackendInterface, SyncSupport { // No synctoken supplied, this is the initial sync. $qb->setMaxResults($limit); $stmt = $qb->executeQuery(); - $values = $stmt->fetchAll(\PDO::FETCH_ASSOC); + $values = $stmt->fetchAllAssociative(); if (empty($values)) { $result['added'] = []; return $result; @@ -1239,7 +1238,7 @@ class CardDavBackend implements BackendInterface, SyncSupport { } $result = $query2->executeQuery(); - $matches = $result->fetchAll(); + $matches = $result->fetchAllAssociative(); $result->closeCursor(); $matches = array_map(function ($match) { return (int)$match['cardid']; @@ -1254,7 +1253,7 @@ class CardDavBackend implements BackendInterface, SyncSupport { foreach (array_chunk($matches, 1000) as $matchesChunk) { $query->setParameter('matches', $matchesChunk, IQueryBuilder::PARAM_INT_ARRAY); $result = $query->executeQuery(); - $cardResults[] = $result->fetchAll(); + $cardResults[] = $result->fetchAllAssociative(); $result->closeCursor(); } @@ -1283,7 +1282,7 @@ class CardDavBackend implements BackendInterface, SyncSupport { ->andWhere($query->expr()->eq('addressbookid', $query->createNamedParameter($bookId))) ->executeQuery(); - $all = $result->fetchAll(PDO::FETCH_COLUMN); + $all = $result->fetchFirstColumn(); $result->closeCursor(); return $all; @@ -1302,7 +1301,7 @@ class CardDavBackend implements BackendInterface, SyncSupport { ->setParameter('id', $id); $result = $query->executeQuery(); - $uri = $result->fetch(); + $uri = $result->fetchAssociative(); $result->closeCursor(); if (!isset($uri['uri'])) { @@ -1326,7 +1325,7 @@ class CardDavBackend implements BackendInterface, SyncSupport { ->where($query->expr()->eq('uri', $query->createNamedParameter($uri))) ->andWhere($query->expr()->eq('addressbookid', $query->createNamedParameter($addressBookId))); $queryResult = $query->executeQuery(); - $contact = $queryResult->fetch(); + $contact = $queryResult->fetchAssociative(); $queryResult->closeCursor(); if (is_array($contact)) { @@ -1437,7 +1436,7 @@ class CardDavBackend implements BackendInterface, SyncSupport { ->andWhere($query->expr()->eq('addressbookid', $query->createNamedParameter($addressBookId))); $result = $query->executeQuery(); - $cardIds = $result->fetch(); + $cardIds = $result->fetchAssociative(); $result->closeCursor(); if (!isset($cardIds['id'])) { diff --git a/apps/dav/lib/Command/RemoveInvalidShares.php b/apps/dav/lib/Command/RemoveInvalidShares.php index 6337a938fa9..3128bca03e2 100644 --- a/apps/dav/lib/Command/RemoveInvalidShares.php +++ b/apps/dav/lib/Command/RemoveInvalidShares.php @@ -42,7 +42,7 @@ class RemoveInvalidShares extends Command { ->from('dav_shares') ->executeQuery(); - while ($row = $result->fetch()) { + while ($row = $result->fetchAssociative()) { $principaluri = $row['principaluri']; $p = $this->principalBackend->getPrincipalByPath($principaluri) ?? $this->remoteUserPrincipalBackend->getPrincipalByPath($principaluri); diff --git a/apps/dav/lib/Controller/InvitationResponseController.php b/apps/dav/lib/Controller/InvitationResponseController.php index 19eb4097b45..425f491adef 100644 --- a/apps/dav/lib/Controller/InvitationResponseController.php +++ b/apps/dav/lib/Controller/InvitationResponseController.php @@ -140,7 +140,7 @@ class InvitationResponseController extends Controller { ->from('calendar_invitations') ->where($query->expr()->eq('token', $query->createNamedParameter($token))); $stmt = $query->executeQuery(); - $row = $stmt->fetch(\PDO::FETCH_ASSOC); + $row = $stmt->fetchAssociative(); $stmt->closeCursor(); if (!$row) { diff --git a/apps/dav/lib/DAV/CustomPropertiesBackend.php b/apps/dav/lib/DAV/CustomPropertiesBackend.php index a0e99233e11..8e7d489dad0 100644 --- a/apps/dav/lib/DAV/CustomPropertiesBackend.php +++ b/apps/dav/lib/DAV/CustomPropertiesBackend.php @@ -345,7 +345,7 @@ class CustomPropertiesBackend implements BackendInterface { ->where($qb->expr()->eq('propertypath', $qb->createNamedParameter($path))); $result = $qb->executeQuery(); $props = []; - while ($row = $result->fetch()) { + while ($row = $result->fetchAssociative()) { $props[$row['propertyname']] = $this->decodeValueFromDatabase($row['propertyvalue'], $row['valuetype']); } $result->closeCursor(); @@ -376,7 +376,7 @@ class CustomPropertiesBackend implements BackendInterface { $propsByPath = []; - while ($row = $result->fetch()) { + while ($row = $result->fetchAssociative()) { $childPath = $prefix . $row['name']; if (!isset($propsByPath[$childPath])) { $propsByPath[$childPath] = []; @@ -474,13 +474,13 @@ class CustomPropertiesBackend implements BackendInterface { foreach ($chunks as $chunk) { $qb->setParameter('requestedProperties', $chunk, IQueryBuilder::PARAM_STR_ARRAY); $result = $qb->executeQuery(); - while ($row = $result->fetch()) { + while ($row = $result->fetchAssociative()) { $props[$row['propertyname']] = $this->decodeValueFromDatabase($row['propertyvalue'], $row['valuetype']); } } } else { $result = $qb->executeQuery(); - while ($row = $result->fetch()) { + while ($row = $result->fetchAssociative()) { $props[$row['propertyname']] = $this->decodeValueFromDatabase($row['propertyvalue'], $row['valuetype']); } } diff --git a/apps/dav/lib/DAV/Sharing/SharingMapper.php b/apps/dav/lib/DAV/Sharing/SharingMapper.php index d6e52c63866..cab45907077 100644 --- a/apps/dav/lib/DAV/Sharing/SharingMapper.php +++ b/apps/dav/lib/DAV/Sharing/SharingMapper.php @@ -31,7 +31,7 @@ class SharingMapper { } $result = $query->executeQuery(); - $rows = $result->fetchAll(); + $rows = $result->fetchAllAssociative(); $result->closeCursor(); return $rows; } @@ -54,7 +54,7 @@ class SharingMapper { ->groupBy(['principaluri', 'access', 'resourceid']) ->executeQuery(); - $rows = $result->fetchAll(); + $rows = $result->fetchAllAssociative(); $result->closeCursor(); return $rows; } @@ -133,7 +133,7 @@ class SharingMapper { ->orderBy('id') ->executeQuery(); - $rows = $result->fetchAll(); + $rows = $result->fetchAllAssociative(); $result->closeCursor(); return $rows; @@ -149,7 +149,7 @@ class SharingMapper { } /** - * @return array{principaluri: string}[] + * @return list * @throws \OCP\DB\Exception */ public function getPrincipalUrisByPrefix(string $resourceType, string $prefix): array { @@ -168,14 +168,15 @@ class SharingMapper { ) ->executeQuery(); - $rows = $result->fetchAll(); + /** @var list $rows */ + $rows = $result->fetchAllAssociative(); $result->closeCursor(); return $rows; } /** - * @psalm-return array{uri: string, principaluri: string}[] + * @psalm-return list * @throws \OCP\DB\Exception */ public function getSharedCalendarsForRemoteUser( @@ -206,7 +207,8 @@ class SharingMapper { IQueryBuilder::PARAM_STR, )); $result = $qb->executeQuery(); - $rows = $result->fetchAll(); + /** @var list $rows */ + $rows = $result->fetchAllAssociative(); $result->closeCursor(); return $rows; @@ -241,7 +243,7 @@ class SharingMapper { IQueryBuilder::PARAM_STR, )); $result = $qb->executeQuery(); - $rows = $result->fetchAll(); + $rows = $result->fetchAllAssociative(); $result->closeCursor(); return $rows; diff --git a/apps/dav/lib/Migration/BuildCalendarSearchIndexBackgroundJob.php b/apps/dav/lib/Migration/BuildCalendarSearchIndexBackgroundJob.php index c6a5c625021..d9642a09f38 100644 --- a/apps/dav/lib/Migration/BuildCalendarSearchIndexBackgroundJob.php +++ b/apps/dav/lib/Migration/BuildCalendarSearchIndexBackgroundJob.php @@ -66,7 +66,7 @@ class BuildCalendarSearchIndexBackgroundJob extends QueuedJob { ->setMaxResults(500); $result = $query->executeQuery(); - while ($row = $result->fetch(\PDO::FETCH_ASSOC)) { + while ($row = $result->fetchAssociative()) { $offset = $row['id']; $calendarData = $row['calendardata']; diff --git a/apps/dav/lib/Migration/BuildSocialSearchIndexBackgroundJob.php b/apps/dav/lib/Migration/BuildSocialSearchIndexBackgroundJob.php index 346c8725b10..5b44df2b69e 100644 --- a/apps/dav/lib/Migration/BuildSocialSearchIndexBackgroundJob.php +++ b/apps/dav/lib/Migration/BuildSocialSearchIndexBackgroundJob.php @@ -62,7 +62,7 @@ class BuildSocialSearchIndexBackgroundJob extends QueuedJob { ->where($query->expr()->like('carddata', $query->createNamedParameter('%SOCIALPROFILE%'))) ->andWhere($query->expr()->gt('id', $query->createNamedParameter((int)$offset, IQueryBuilder::PARAM_INT))) ->setMaxResults(100); - $social_cards = $query->executeQuery()->fetchAll(); + $social_cards = $query->executeQuery()->fetchAllAssociative(); if (empty($social_cards)) { return $stopAt; diff --git a/apps/dav/lib/Migration/CalDAVRemoveEmptyValue.php b/apps/dav/lib/Migration/CalDAVRemoveEmptyValue.php index 24e182e46eb..42c419a733b 100644 --- a/apps/dav/lib/Migration/CalDAVRemoveEmptyValue.php +++ b/apps/dav/lib/Migration/CalDAVRemoveEmptyValue.php @@ -88,7 +88,7 @@ class CalDAVRemoveEmptyValue implements IRepairStep { $query->setFirstResult($chunk * $chunkSize); $result = $query->executeQuery(); - while ($row = $result->fetch()) { + while ($row = $result->fetchAssociative()) { if (mb_strpos($row['calendardata'], $pattern) !== false) { unset($row['calendardata']); $rows[] = $row; @@ -112,7 +112,7 @@ class CalDAVRemoveEmptyValue implements IRepairStep { )); $result = $query->executeQuery(); - $rows = $result->fetchAll(); + $rows = $result->fetchAllAssociative(); $result->closeCursor(); return $rows; diff --git a/apps/dav/lib/Migration/RefreshWebcalJobRegistrar.php b/apps/dav/lib/Migration/RefreshWebcalJobRegistrar.php index 8f36e1e3762..2c98bf5f0cb 100644 --- a/apps/dav/lib/Migration/RefreshWebcalJobRegistrar.php +++ b/apps/dav/lib/Migration/RefreshWebcalJobRegistrar.php @@ -45,7 +45,7 @@ class RefreshWebcalJobRegistrar implements IRepairStep { $stmt = $query->executeQuery(); $count = 0; - while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { + while ($row = $stmt->fetchAssociative()) { $args = [ 'principaluri' => $row['principaluri'], 'uri' => $row['uri'], diff --git a/apps/dav/lib/Migration/RemoveClassifiedEventActivity.php b/apps/dav/lib/Migration/RemoveClassifiedEventActivity.php index f0d208f4f33..4aae1515f9e 100644 --- a/apps/dav/lib/Migration/RemoveClassifiedEventActivity.php +++ b/apps/dav/lib/Migration/RemoveClassifiedEventActivity.php @@ -58,7 +58,7 @@ class RemoveClassifiedEventActivity implements IRepairStep { ->where($query->expr()->eq('o.classification', $query->createNamedParameter(CalDavBackend::CLASSIFICATION_PRIVATE))); $result = $query->executeQuery(); - while ($row = $result->fetch()) { + while ($row = $result->fetchAssociative()) { if ($row['principaluri'] === null) { continue; } @@ -92,7 +92,7 @@ class RemoveClassifiedEventActivity implements IRepairStep { ->where($query->expr()->eq('o.classification', $query->createNamedParameter(CalDavBackend::CLASSIFICATION_CONFIDENTIAL))); $result = $query->executeQuery(); - while ($row = $result->fetch()) { + while ($row = $result->fetchAssociative()) { if ($row['principaluri'] === null) { continue; } diff --git a/apps/dav/lib/Migration/RemoveDeletedUsersCalendarSubscriptions.php b/apps/dav/lib/Migration/RemoveDeletedUsersCalendarSubscriptions.php index 69d27404cdf..29b586c08cb 100644 --- a/apps/dav/lib/Migration/RemoveDeletedUsersCalendarSubscriptions.php +++ b/apps/dav/lib/Migration/RemoveDeletedUsersCalendarSubscriptions.php @@ -88,7 +88,7 @@ class RemoveDeletedUsersCalendarSubscriptions implements IRepairStep { ->setFirstResult($this->progress); $result = $query->executeQuery(); - while ($row = $result->fetch()) { + while ($row = $result->fetchAssociative()) { $username = $this->getPrincipal($row['principaluri']); if (!$this->userManager->userExists($username)) { $this->orphanSubscriptionIds[] = (int)$row['id']; diff --git a/apps/dav/lib/Migration/Version1025Date20240308063933.php b/apps/dav/lib/Migration/Version1025Date20240308063933.php index d84acf8fea9..83a0b46a23e 100644 --- a/apps/dav/lib/Migration/Version1025Date20240308063933.php +++ b/apps/dav/lib/Migration/Version1025Date20240308063933.php @@ -64,7 +64,7 @@ class Version1025Date20240308063933 extends SimpleMigrationStep { ->setFirstResult($limit) ->setMaxResults(1); $oldestIdResult = $thresholdSelect->executeQuery(); - $oldestId = $oldestIdResult->fetchColumn(); + $oldestId = $oldestIdResult->fetchOne(); $oldestIdResult->closeCursor(); $qb = $this->db->getQueryBuilder(); diff --git a/apps/dav/tests/unit/CalDAV/Reminder/BackendTest.php b/apps/dav/tests/unit/CalDAV/Reminder/BackendTest.php index 561002ee59e..29d4e11ea34 100644 --- a/apps/dav/tests/unit/CalDAV/Reminder/BackendTest.php +++ b/apps/dav/tests/unit/CalDAV/Reminder/BackendTest.php @@ -46,7 +46,7 @@ class BackendTest extends TestCase { $rows = $query->select('*') ->from('calendar_reminders') ->executeQuery() - ->fetchAll(); + ->fetchAllAssociative(); $this->assertCount(4, $rows); @@ -56,7 +56,7 @@ class BackendTest extends TestCase { $rows = $query->select('*') ->from('calendar_reminders') ->executeQuery() - ->fetchAll(); + ->fetchAllAssociative(); $this->assertCount(2, $rows); } @@ -66,7 +66,7 @@ class BackendTest extends TestCase { $rows = $query->select('*') ->from('calendar_reminders') ->executeQuery() - ->fetchAll(); + ->fetchAllAssociative(); $this->assertCount(4, $rows); @@ -76,7 +76,7 @@ class BackendTest extends TestCase { $rows = $query->select('*') ->from('calendar_reminders') ->executeQuery() - ->fetchAll(); + ->fetchAllAssociative(); $this->assertCount(1, $rows); } @@ -86,7 +86,7 @@ class BackendTest extends TestCase { $rows = $query->select('*') ->from('calendar_reminders') ->executeQuery() - ->fetchAll(); + ->fetchAllAssociative(); $this->assertCount(4, $rows); @@ -96,7 +96,7 @@ class BackendTest extends TestCase { $rows = $query->select('*') ->from('calendar_reminders') ->executeQuery() - ->fetchAll(); + ->fetchAllAssociative(); $this->assertCount(3, $rows); } @@ -193,7 +193,7 @@ class BackendTest extends TestCase { $rows = $query->select('*') ->from('calendar_reminders') ->executeQuery() - ->fetchAll(); + ->fetchAllAssociative(); $this->assertCount(4, $rows); @@ -204,7 +204,7 @@ class BackendTest extends TestCase { $rows = $query->select('*') ->from('calendar_reminders') ->executeQuery() - ->fetchAll(); + ->fetchAllAssociative(); $this->assertCount(5, $rows); @@ -231,7 +231,7 @@ class BackendTest extends TestCase { $rows = $query->select('*') ->from('calendar_reminders') ->executeQuery() - ->fetchAll(); + ->fetchAllAssociative(); $this->assertCount(4, $rows); @@ -247,7 +247,7 @@ class BackendTest extends TestCase { ->from('calendar_reminders') ->where($query->expr()->eq('id', $query->createNamedParameter($reminderId))) ->executeQuery() - ->fetch(); + ->fetchAssociative(); $this->assertEquals((int)$row['notification_date'], 123700); } diff --git a/apps/dav/tests/unit/CardDAV/CardDavBackendTest.php b/apps/dav/tests/unit/CardDAV/CardDavBackendTest.php index 00ab531dc90..2c5c4789fca 100644 --- a/apps/dav/tests/unit/CardDAV/CardDavBackendTest.php +++ b/apps/dav/tests/unit/CardDAV/CardDavBackendTest.php @@ -550,7 +550,7 @@ class CardDavBackendTest extends TestCase { ->orderBy('name'); $qResult = $query->executeQuery(); - $result = $qResult->fetchAll(); + $result = $qResult->fetchAllAssociative(); $qResult->closeCursor(); $this->assertSame(2, count($result)); @@ -575,7 +575,7 @@ class CardDavBackendTest extends TestCase { ->from('cards_properties'); $qResult = $query->executeQuery(); - $result = $qResult->fetchAll(); + $result = $qResult->fetchAllAssociative(); $qResult->closeCursor(); $this->assertSame(1, count($result)); @@ -620,7 +620,7 @@ class CardDavBackendTest extends TestCase { ->from('cards_properties'); $qResult = $query->executeQuery(); - $result = $qResult->fetchAll(); + $result = $qResult->fetchAllAssociative(); $qResult->closeCursor(); $this->assertSame(1, count($result)); diff --git a/apps/dav/tests/unit/Command/RemoveInvalidSharesTest.php b/apps/dav/tests/unit/Command/RemoveInvalidSharesTest.php index 6caec926636..50ca649b431 100644 --- a/apps/dav/tests/unit/Command/RemoveInvalidSharesTest.php +++ b/apps/dav/tests/unit/Command/RemoveInvalidSharesTest.php @@ -71,7 +71,7 @@ class RemoveInvalidSharesTest extends TestCase { ), )); $result = $query->executeQuery(); - $data = $result->fetchAll(); + $data = $result->fetchAllAssociative(); $result->closeCursor(); return $data; diff --git a/apps/dav/tests/unit/DAV/CustomPropertiesBackendTest.php b/apps/dav/tests/unit/DAV/CustomPropertiesBackendTest.php index 3e333bddabf..a7ef373c989 100644 --- a/apps/dav/tests/unit/DAV/CustomPropertiesBackendTest.php +++ b/apps/dav/tests/unit/DAV/CustomPropertiesBackendTest.php @@ -112,7 +112,7 @@ class CustomPropertiesBackendTest extends TestCase { $result = $query->executeQuery(); $data = []; - while ($row = $result->fetch()) { + while ($row = $result->fetchAssociative()) { $value = $row['propertyvalue']; if ((int)$row['valuetype'] === CustomPropertiesBackend::PROPERTY_TYPE_HREF) { $value = new Href($value); diff --git a/apps/federatedfilesharing/lib/FederatedShareProvider.php b/apps/federatedfilesharing/lib/FederatedShareProvider.php index 8a2c12e0ac8..47ed3e893e9 100644 --- a/apps/federatedfilesharing/lib/FederatedShareProvider.php +++ b/apps/federatedfilesharing/lib/FederatedShareProvider.php @@ -271,7 +271,7 @@ class FederatedShareProvider implements IShareProvider, IShareProviderSupportsAl ->where($query->expr()->eq('user', $query->createNamedParameter($share->getShareOwner()))) ->andWhere($query->expr()->eq('mountpoint', $query->createNamedParameter($share->getTarget()))); $qResult = $query->executeQuery(); - $result = $qResult->fetchAll(); + $result = $qResult->fetchAllAssociative(); $qResult->closeCursor(); if (isset($result[0]) && (int)$result[0]['remote_id'] > 0) { @@ -410,7 +410,7 @@ class FederatedShareProvider implements IShareProvider, IShareProviderSupportsAl $query->select('remote_id')->from('federated_reshares') ->where($query->expr()->eq('share_id', $query->createNamedParameter((int)$share->getId()))); $result = $query->executeQuery(); - $data = $result->fetch(); + $data = $result->fetchAssociative(); $result->closeCursor(); if (!is_array($data) || !isset($data['remote_id'])) { @@ -442,7 +442,7 @@ class FederatedShareProvider implements IShareProvider, IShareProviderSupportsAl ->orderBy('id'); $cursor = $qb->executeQuery(); - while ($data = $cursor->fetch()) { + while ($data = $cursor->fetchAssociative()) { $children[] = $this->createShareObject($data); } $cursor->closeCursor(); @@ -591,7 +591,7 @@ class FederatedShareProvider implements IShareProvider, IShareProviderSupportsAl $cursor = $qb->executeQuery(); $shares = []; - while ($data = $cursor->fetch()) { + while ($data = $cursor->fetchAssociative()) { $shares[$data['fileid']][] = $this->createShareObject($data); } $cursor->closeCursor(); @@ -647,7 +647,7 @@ class FederatedShareProvider implements IShareProvider, IShareProviderSupportsAl $cursor = $qb->executeQuery(); $shares = []; - while ($data = $cursor->fetch()) { + while ($data = $cursor->fetchAssociative()) { $shares[] = $this->createShareObject($data); } $cursor->closeCursor(); @@ -667,7 +667,7 @@ class FederatedShareProvider implements IShareProvider, IShareProviderSupportsAl ->andWhere($qb->expr()->in('share_type', $qb->createNamedParameter($this->supportedShareType, IQueryBuilder::PARAM_INT_ARRAY))); $cursor = $qb->executeQuery(); - $data = $cursor->fetch(); + $data = $cursor->fetchAssociative(); $cursor->closeCursor(); if ($data === false) { @@ -700,7 +700,7 @@ class FederatedShareProvider implements IShareProvider, IShareProviderSupportsAl ->executeQuery(); $shares = []; - while ($data = $cursor->fetch()) { + while ($data = $cursor->fetchAssociative()) { $shares[] = $this->createShareObject($data); } $cursor->closeCursor(); @@ -739,7 +739,7 @@ class FederatedShareProvider implements IShareProvider, IShareProviderSupportsAl $cursor = $qb->executeQuery(); - while ($data = $cursor->fetch()) { + while ($data = $cursor->fetchAssociative()) { $shares[] = $this->createShareObject($data); } $cursor->closeCursor(); @@ -764,7 +764,7 @@ class FederatedShareProvider implements IShareProvider, IShareProviderSupportsAl ->andWhere($qb->expr()->eq('token', $qb->createNamedParameter($token))) ->executeQuery(); - $data = $cursor->fetch(); + $data = $cursor->fetchAssociative(); if ($data === false) { throw new ShareNotFound('Share not found', $this->l->t('Could not find share')); @@ -794,7 +794,7 @@ class FederatedShareProvider implements IShareProvider, IShareProviderSupportsAl ->where($qb->expr()->eq('id', $qb->createNamedParameter($id))); $cursor = $qb->executeQuery(); - $data = $cursor->fetch(); + $data = $cursor->fetchAssociative(); $cursor->closeCursor(); if ($data === false) { @@ -907,7 +907,7 @@ class FederatedShareProvider implements IShareProvider, IShareProviderSupportsAl // This is not a typo, the group ID is really stored in the 'user' column ->andWhere($qb->expr()->eq('user', $qb->createNamedParameter($gid))); $cursor = $qb->executeQuery(); - $parentShareIds = $cursor->fetchAll(\PDO::FETCH_COLUMN); + $parentShareIds = $cursor->fetchFirstColumn(); $cursor->closeCursor(); if ($parentShareIds === []) { return; @@ -929,7 +929,7 @@ class FederatedShareProvider implements IShareProvider, IShareProviderSupportsAl // This is not a typo, the group ID is really stored in the 'user' column ->andWhere($qb->expr()->eq('user', $qb->createNamedParameter($gid))); $cursor = $qb->executeQuery(); - $parentShareIds = $cursor->fetchAll(\PDO::FETCH_COLUMN); + $parentShareIds = $cursor->fetchFirstColumn(); $cursor->closeCursor(); if ($parentShareIds === []) { return; @@ -1047,14 +1047,14 @@ class FederatedShareProvider implements IShareProvider, IShareProviderSupportsAl $cursor = $qb->executeQuery(); if ($currentAccess === false) { - $remote = $cursor->fetch() !== false; + $remote = $cursor->fetchAssociative() !== false; $cursor->closeCursor(); return ['remote' => $remote]; } $remote = []; - while ($row = $cursor->fetch()) { + while ($row = $cursor->fetchAssociative()) { $remote[$row['share_with']] = [ 'node_id' => $row['file_source'], 'token' => $row['token'], @@ -1073,7 +1073,7 @@ class FederatedShareProvider implements IShareProvider, IShareProviderSupportsAl ->where($qb->expr()->in('share_type', $qb->createNamedParameter([IShare::TYPE_REMOTE_GROUP, IShare::TYPE_REMOTE], IQueryBuilder::PARAM_INT_ARRAY))); $cursor = $qb->executeQuery(); - while ($data = $cursor->fetch()) { + while ($data = $cursor->fetchAssociative()) { try { $share = $this->createShareObject($data); } catch (InvalidShare $e) { diff --git a/apps/federatedfilesharing/lib/OCM/CloudFederationProviderFiles.php b/apps/federatedfilesharing/lib/OCM/CloudFederationProviderFiles.php index 461a4b1948a..176301a1f2b 100644 --- a/apps/federatedfilesharing/lib/OCM/CloudFederationProviderFiles.php +++ b/apps/federatedfilesharing/lib/OCM/CloudFederationProviderFiles.php @@ -482,7 +482,7 @@ class CloudFederationProviderFiles implements ISignedCloudFederationProvider { ); $result = $qb->executeQuery(); - $share = $result->fetch(); + $share = $result->fetchAssociative(); $result->closeCursor(); if ($token && $id && !empty($share)) { diff --git a/apps/federatedfilesharing/tests/FederatedShareProviderTest.php b/apps/federatedfilesharing/tests/FederatedShareProviderTest.php index 6ec0ca13852..4acf7d12e0b 100644 --- a/apps/federatedfilesharing/tests/FederatedShareProviderTest.php +++ b/apps/federatedfilesharing/tests/FederatedShareProviderTest.php @@ -169,7 +169,7 @@ class FederatedShareProviderTest extends \Test\TestCase { ->where($qb->expr()->eq('id', $qb->createNamedParameter($share->getId()))) ->executeQuery(); - $data = $stmt->fetch(); + $data = $stmt->fetchAssociative(); $stmt->closeCursor(); $expected = [ @@ -256,7 +256,7 @@ class FederatedShareProviderTest extends \Test\TestCase { ->where($qb->expr()->eq('id', $qb->createNamedParameter($share->getId()))) ->executeQuery(); - $data = $stmt->fetch(); + $data = $stmt->fetchAssociative(); $stmt->closeCursor(); $this->assertFalse($data); @@ -317,7 +317,7 @@ class FederatedShareProviderTest extends \Test\TestCase { ->where($qb->expr()->eq('id', $qb->createNamedParameter($share->getId()))) ->executeQuery(); - $data = $stmt->fetch(); + $data = $stmt->fetchAssociative(); $stmt->closeCursor(); $this->assertFalse($data); @@ -360,7 +360,7 @@ class FederatedShareProviderTest extends \Test\TestCase { ->where($qb->expr()->eq('id', $qb->createNamedParameter($share->getId()))) ->executeQuery(); - $data = $stmt->fetch(); + $data = $stmt->fetchAssociative(); $stmt->closeCursor(); $this->assertFalse($data); @@ -732,7 +732,7 @@ class FederatedShareProviderTest extends \Test\TestCase { $qb->expr()->eq('id', $qb->createNamedParameter($id)) ); $cursor = $qb->executeQuery(); - $data = $cursor->fetchAll(); + $data = $cursor->fetchAllAssociative(); $cursor->closeCursor(); $this->assertCount($rowDeleted ? 0 : 1, $data); diff --git a/apps/federation/lib/DbHandler.php b/apps/federation/lib/DbHandler.php index a56539bb30c..1dac5a2f45f 100644 --- a/apps/federation/lib/DbHandler.php +++ b/apps/federation/lib/DbHandler.php @@ -84,14 +84,15 @@ class DbHandler { ->setParameter('id', $id, IQueryBuilder::PARAM_INT); $qResult = $query->executeQuery(); - $result = $qResult->fetchAll(); + /** @var array{id: int, url: string, url_hash: string, token: ?string, shared_secret: ?string, status: int, sync_token: ?string} $result */ + $result = $qResult->fetchAssociative(); $qResult->closeCursor(); - if (empty($result)) { + if ($result === false) { throw new \Exception('No Server found with ID: ' . $id); } - return $result[0]; + return $result; } /** @@ -105,7 +106,7 @@ class DbHandler { $query->select(['url', 'url_hash', 'id', 'status', 'shared_secret', 'sync_token']) ->from($this->dbTable); $statement = $query->executeQuery(); - $result = $statement->fetchAll(); + $result = $statement->fetchAllAssociative(); $statement->closeCursor(); return $result; } @@ -121,7 +122,7 @@ class DbHandler { ->where($query->expr()->eq('url_hash', $query->createParameter('url_hash'))) ->setParameter('url_hash', $hash); $statement = $query->executeQuery(); - $result = $statement->fetchAll(); + $result = $statement->fetchAllAssociative(); $statement->closeCursor(); return !empty($result); @@ -153,7 +154,7 @@ class DbHandler { ->setParameter('url_hash', $hash); $statement = $query->executeQuery(); - $result = $statement->fetch(); + $result = $statement->fetchAssociative(); $statement->closeCursor(); if (!isset($result['token'])) { @@ -188,7 +189,7 @@ class DbHandler { ->setParameter('url_hash', $hash); $statement = $query->executeQuery(); - $result = $statement->fetch(); + $result = $statement->fetchAssociative(); $statement->closeCursor(); return (string)$result['shared_secret']; } @@ -219,7 +220,7 @@ class DbHandler { ->setParameter('url_hash', $hash); $statement = $query->executeQuery(); - $result = $statement->fetch(); + $result = $statement->fetchAssociative(); $statement->closeCursor(); return (int)$result['status']; } @@ -259,7 +260,7 @@ class DbHandler { ->where($query->expr()->eq('shared_secret', $query->createNamedParameter($password))); $statement = $query->executeQuery(); - $result = $statement->fetch(); + $result = $statement->fetchAssociative(); $statement->closeCursor(); return !empty($result); } diff --git a/apps/federation/tests/DbHandlerTest.php b/apps/federation/tests/DbHandlerTest.php index 4e9e1bd2c88..def093f3685 100644 --- a/apps/federation/tests/DbHandlerTest.php +++ b/apps/federation/tests/DbHandlerTest.php @@ -37,7 +37,7 @@ class DbHandlerTest extends TestCase { $query = $this->connection->getQueryBuilder()->select('*')->from($this->dbTable); $qResult = $query->executeQuery(); - $result = $qResult->fetchAll(); + $result = $qResult->fetchAllAssociative(); $qResult->closeCursor(); $this->assertEmpty($result, 'we need to start with a empty trusted_servers table'); } @@ -62,7 +62,7 @@ class DbHandlerTest extends TestCase { $query = $this->connection->getQueryBuilder()->select('*')->from($this->dbTable); $qResult = $query->executeQuery(); - $result = $qResult->fetchAll(); + $result = $qResult->fetchAllAssociative(); $qResult->closeCursor(); $this->assertCount(1, $result); $this->assertSame($expectedUrl, $result[0]['url']); @@ -86,7 +86,7 @@ class DbHandlerTest extends TestCase { $query = $this->connection->getQueryBuilder()->select('*')->from($this->dbTable); $qResult = $query->executeQuery(); - $result = $qResult->fetchAll(); + $result = $qResult->fetchAllAssociative(); $qResult->closeCursor(); $this->assertCount(2, $result); $this->assertSame('server1', $result[0]['url']); @@ -98,7 +98,7 @@ class DbHandlerTest extends TestCase { $query = $this->connection->getQueryBuilder()->select('*')->from($this->dbTable); $qResult = $query->executeQuery(); - $result = $qResult->fetchAll(); + $result = $qResult->fetchAllAssociative(); $qResult->closeCursor(); $this->assertCount(1, $result); $this->assertSame('server1', $result[0]['url']); @@ -147,7 +147,7 @@ class DbHandlerTest extends TestCase { $query = $this->connection->getQueryBuilder()->select('*')->from($this->dbTable); $qResult = $query->executeQuery(); - $result = $qResult->fetchAll(); + $result = $qResult->fetchAllAssociative(); $qResult->closeCursor(); $this->assertCount(1, $result); $this->assertSame(null, $result[0]['token']); @@ -155,7 +155,7 @@ class DbHandlerTest extends TestCase { $query = $this->connection->getQueryBuilder()->select('*')->from($this->dbTable); $qResult = $query->executeQuery(); - $result = $qResult->fetchAll(); + $result = $qResult->fetchAllAssociative(); $qResult->closeCursor(); $this->assertCount(1, $result); $this->assertSame('token', $result[0]['token']); @@ -174,7 +174,7 @@ class DbHandlerTest extends TestCase { $query = $this->connection->getQueryBuilder()->select('*')->from($this->dbTable); $qResult = $query->executeQuery(); - $result = $qResult->fetchAll(); + $result = $qResult->fetchAllAssociative(); $qResult->closeCursor(); $this->assertCount(1, $result); $this->assertSame(null, $result[0]['shared_secret']); @@ -182,7 +182,7 @@ class DbHandlerTest extends TestCase { $query = $this->connection->getQueryBuilder()->select('*')->from($this->dbTable); $qResult = $query->executeQuery(); - $result = $qResult->fetchAll(); + $result = $qResult->fetchAllAssociative(); $qResult->closeCursor(); $this->assertCount(1, $result); $this->assertSame('secret', $result[0]['shared_secret']); @@ -201,7 +201,7 @@ class DbHandlerTest extends TestCase { $query = $this->connection->getQueryBuilder()->select('*')->from($this->dbTable); $qResult = $query->executeQuery(); - $result = $qResult->fetchAll(); + $result = $qResult->fetchAllAssociative(); $qResult->closeCursor(); $this->assertCount(1, $result); $this->assertSame(TrustedServers::STATUS_PENDING, (int)$result[0]['status']); @@ -209,7 +209,7 @@ class DbHandlerTest extends TestCase { $query = $this->connection->getQueryBuilder()->select('*')->from($this->dbTable); $qResult = $query->executeQuery(); - $result = $qResult->fetchAll(); + $result = $qResult->fetchAllAssociative(); $qResult->closeCursor(); $this->assertCount(1, $result); $this->assertSame(TrustedServers::STATUS_OK, (int)$result[0]['status']); diff --git a/apps/files/lib/BackgroundJob/DeleteOrphanedItems.php b/apps/files/lib/BackgroundJob/DeleteOrphanedItems.php index b925974f24a..b4e38224812 100644 --- a/apps/files/lib/BackgroundJob/DeleteOrphanedItems.php +++ b/apps/files/lib/BackgroundJob/DeleteOrphanedItems.php @@ -81,7 +81,7 @@ class DeleteOrphanedItems extends TimedJob { $deletedInLastChunk = self::CHUNK_SIZE; while ($deletedInLastChunk === self::CHUNK_SIZE) { - $chunk = $query->executeQuery()->fetchAll(\PDO::FETCH_COLUMN); + $chunk = $query->executeQuery()->fetchFirstColumn(); $deletedInLastChunk = count($chunk); $deleteQuery->setParameter('objectid', $chunk, IQueryBuilder::PARAM_INT_ARRAY); @@ -112,7 +112,7 @@ class DeleteOrphanedItems extends TimedJob { $minId = 0; while (true) { $query->setParameter('min_id', $minId); - $rows = $query->executeQuery()->fetchAll(\PDO::FETCH_COLUMN); + $rows = $query->executeQuery()->fetchFirstColumn(); if (count($rows) > 0) { $minId = $rows[count($rows) - 1]; yield $rows; @@ -127,7 +127,7 @@ class DeleteOrphanedItems extends TimedJob { $qb->select('fileid') ->from('filecache') ->where($qb->expr()->in('fileid', $qb->createNamedParameter($ids, IQueryBuilder::PARAM_INT_ARRAY))); - $found = $qb->executeQuery()->fetchAll(\PDO::FETCH_COLUMN); + $found = $qb->executeQuery()->fetchFirstColumn(); return array_diff($ids, $found); } diff --git a/apps/files/lib/BackgroundJob/ScanFiles.php b/apps/files/lib/BackgroundJob/ScanFiles.php index f3f9093d648..d1c39d2c294 100644 --- a/apps/files/lib/BackgroundJob/ScanFiles.php +++ b/apps/files/lib/BackgroundJob/ScanFiles.php @@ -76,7 +76,7 @@ class ScanFiles extends TimedJob { ->runAcrossAllShards(); $result = $query->executeQuery(); - while ($res = $result->fetch()) { + while ($res = $result->fetchAssociative()) { if ($res['user_id']) { return $res['user_id']; } @@ -114,7 +114,7 @@ class ScanFiles extends TimedJob { $query = $this->connection->getQueryBuilder(); $query->selectDistinct('storage_id') ->from('mounts'); - return $query->executeQuery()->fetchAll(\PDO::FETCH_COLUMN); + return $query->executeQuery()->fetchFirstColumn(); } /** diff --git a/apps/files/lib/Command/DeleteOrphanedFiles.php b/apps/files/lib/Command/DeleteOrphanedFiles.php index 37cb3159f4a..8f2ccbe0551 100644 --- a/apps/files/lib/Command/DeleteOrphanedFiles.php +++ b/apps/files/lib/Command/DeleteOrphanedFiles.php @@ -64,7 +64,7 @@ class DeleteOrphanedFiles extends Command { ->from('filecache') ->groupBy('storage') ->runAcrossAllShards(); - return $query->executeQuery()->fetchAll(\PDO::FETCH_COLUMN); + return $query->executeQuery()->fetchFirstColumn(); } private function getExistingStorages(): array { @@ -72,7 +72,7 @@ class DeleteOrphanedFiles extends Command { $query->select('numeric_id') ->from('storages') ->groupBy('numeric_id'); - return $query->executeQuery()->fetchAll(\PDO::FETCH_COLUMN); + return $query->executeQuery()->fetchFirstColumn(); } /** @@ -89,7 +89,7 @@ class DeleteOrphanedFiles extends Command { $storageIdChunks = array_chunk($storageIds, self::CHUNK_SIZE); foreach ($storageIdChunks as $storageIdChunk) { $query->setParameter('storage_ids', $storageIdChunk, IQueryBuilder::PARAM_INT_ARRAY); - $chunk = $query->executeQuery()->fetchAll(); + $chunk = $query->executeQuery()->fetchAllAssociative(); foreach ($chunk as $row) { $result[$row['storage']][] = $row['fileid']; } @@ -155,7 +155,7 @@ class DeleteOrphanedFiles extends Command { while ($deletedInLastChunk === self::CHUNK_SIZE) { $deletedInLastChunk = 0; $result = $query->executeQuery(); - while ($row = $result->fetch()) { + while ($row = $result->fetchAssociative()) { $deletedInLastChunk++; $deletedEntries += $deleteQuery->setParameter('storageid', (int)$row['storage_id']) ->executeStatement(); diff --git a/apps/files/lib/Command/RepairTree.php b/apps/files/lib/Command/RepairTree.php index 3f7da68fb22..b8a7eeebd59 100644 --- a/apps/files/lib/Command/RepairTree.php +++ b/apps/files/lib/Command/RepairTree.php @@ -78,7 +78,7 @@ class RepairTree extends Command { ->from('filecache') ->where($query->expr()->eq('storage', $query->createNamedParameter($storage))) ->andWhere($query->expr()->eq('path_hash', $query->createNamedParameter(md5($path)))); - return $query->executeQuery()->fetch(\PDO::FETCH_COLUMN); + return $query->executeQuery()->fetchOne(); } private function deleteById(int $fileId): void { @@ -108,6 +108,6 @@ class RepairTree extends Command { $query->expr()->neq('f.storage', 'p.storage') )); - return $query->executeQuery()->fetchAll(); + return $query->executeQuery()->fetchAllAssociative(); } } diff --git a/apps/files/tests/BackgroundJob/DeleteOrphanedItemsJobTest.php b/apps/files/tests/BackgroundJob/DeleteOrphanedItemsJobTest.php index 17fd69a332c..5202037b6a1 100644 --- a/apps/files/tests/BackgroundJob/DeleteOrphanedItemsJobTest.php +++ b/apps/files/tests/BackgroundJob/DeleteOrphanedItemsJobTest.php @@ -44,7 +44,7 @@ class DeleteOrphanedItemsJobTest extends \Test\TestCase { $query->select('*') ->from($table); $result = $query->executeQuery(); - $mapping = $result->fetchAll(); + $mapping = $result->fetchAllAssociative(); $result->closeCursor(); return $mapping; diff --git a/apps/files/tests/Command/DeleteOrphanedFilesTest.php b/apps/files/tests/Command/DeleteOrphanedFilesTest.php index 18b484123b9..0abff625807 100644 --- a/apps/files/tests/Command/DeleteOrphanedFilesTest.php +++ b/apps/files/tests/Command/DeleteOrphanedFilesTest.php @@ -62,7 +62,7 @@ class DeleteOrphanedFilesTest extends TestCase { $query->select('*') ->from('filecache') ->where($query->expr()->eq('fileid', $query->createNamedParameter($fileId))); - return $query->executeQuery()->fetchAll(); + return $query->executeQuery()->fetchAllAssociative(); } protected function getMounts(int $storageId): array { @@ -70,7 +70,7 @@ class DeleteOrphanedFilesTest extends TestCase { $query->select('*') ->from('mounts') ->where($query->expr()->eq('storage_id', $query->createNamedParameter($storageId))); - return $query->executeQuery()->fetchAll(); + return $query->executeQuery()->fetchAllAssociative(); } /** diff --git a/apps/files_external/lib/Command/Notify.php b/apps/files_external/lib/Command/Notify.php index 9f42d974ecf..3706ad2fd3e 100644 --- a/apps/files_external/lib/Command/Notify.php +++ b/apps/files_external/lib/Command/Notify.php @@ -177,7 +177,7 @@ class Notify extends StorageAuthBase { ->where($qb->expr()->eq('mount_id', $qb->createNamedParameter($mountId, IQueryBuilder::PARAM_INT))) ->andWhere($qb->expr()->eq('path_hash', $qb->createNamedParameter($pathHash, IQueryBuilder::PARAM_STR))) ->executeQuery() - ->fetchAll(); + ->fetchAllAssociative(); } private function updateParent(array $storageIds, string $parent): int { diff --git a/apps/files_external/lib/Migration/Version1015Date20211104103506.php b/apps/files_external/lib/Migration/Version1015Date20211104103506.php index 20a279d805c..e24a306d8b1 100644 --- a/apps/files_external/lib/Migration/Version1015Date20211104103506.php +++ b/apps/files_external/lib/Migration/Version1015Date20211104103506.php @@ -37,7 +37,7 @@ class Version1015Date20211104103506 extends SimpleMigrationStep { throw new \Exception('Could not fetch existing mounts for migration'); } - while ($mount = $mounts->fetch()) { + while ($mount = $mounts->fetchAssociative()) { $config = $this->getStorageConfig((int)$mount['mount_id']); $hostname = $config['hostname']; $bucket = $config['bucket']; @@ -82,7 +82,7 @@ class Version1015Date20211104103506 extends SimpleMigrationStep { ->from('external_config') ->where($qb->expr()->eq('mount_id', $qb->createPositionalParameter($mountId))); $config = []; - foreach ($qb->executeQuery()->fetchAll() as $row) { + foreach ($qb->executeQuery()->fetchAllAssociative() as $row) { $config[$row['key']] = $row['value']; } return $config; diff --git a/apps/files_external/lib/Service/DBConfigService.php b/apps/files_external/lib/Service/DBConfigService.php index 984b9313e41..f08f3442a47 100644 --- a/apps/files_external/lib/Service/DBConfigService.php +++ b/apps/files_external/lib/Service/DBConfigService.php @@ -100,7 +100,7 @@ class DBConfigService { ) ->groupBy(['a.mount_id']); $stmt = $query->executeQuery(); - $result = $stmt->fetchAll(); + $result = $stmt->fetchAllAssociative(); $stmt->closeCursor(); foreach ($result as $row) { @@ -378,7 +378,7 @@ class DBConfigService { private function getMountsFromQuery(IQueryBuilder $query) { $result = $query->executeQuery(); - $mounts = $result->fetchAll(); + $mounts = $result->fetchAllAssociative(); $uniqueMounts = []; foreach ($mounts as $mount) { $id = $mount['mount_id']; @@ -429,7 +429,7 @@ class DBConfigService { ->where($builder->expr()->in('mount_id', $placeHolders)); $result = $query->executeQuery(); - $rows = $result->fetchAll(); + $rows = $result->fetchAllAssociative(); $result->closeCursor(); $result = []; @@ -519,6 +519,6 @@ class DBConfigService { ->where($builder->expr()->eq('mount_point', $builder->createNamedParameter('/'))) ->setMaxResults(1); $result = $query->executeQuery(); - return count($result->fetchAll()) > 0; + return count($result->fetchAllAssociative()) > 0; } } diff --git a/apps/files_sharing/lib/BackgroundJob/FederatedSharesDiscoverJob.php b/apps/files_sharing/lib/BackgroundJob/FederatedSharesDiscoverJob.php index ca4c82c03d7..2ecb504a9ce 100644 --- a/apps/files_sharing/lib/BackgroundJob/FederatedSharesDiscoverJob.php +++ b/apps/files_sharing/lib/BackgroundJob/FederatedSharesDiscoverJob.php @@ -37,7 +37,7 @@ class FederatedSharesDiscoverJob extends TimedJob { ->from('share_external'); $result = $qb->executeQuery(); - while ($row = $result->fetch()) { + while ($row = $result->fetchAssociative()) { $this->discoveryService->discover($row['remote'], 'FEDERATED_SHARING', true); try { $this->ocmDiscoveryService->discover($row['remote'], true); diff --git a/apps/files_sharing/lib/Command/CleanupRemoteStorages.php b/apps/files_sharing/lib/Command/CleanupRemoteStorages.php index 809481e5c0f..18d1c2a1157 100644 --- a/apps/files_sharing/lib/Command/CleanupRemoteStorages.php +++ b/apps/files_sharing/lib/Command/CleanupRemoteStorages.php @@ -140,7 +140,7 @@ class CleanupRemoteStorages extends Command { $remoteStorages = []; - while ($row = $result->fetch()) { + while ($row = $result->fetchAssociative()) { $remoteStorages[$row['id']] = $row['numeric_id']; } $result->closeCursor(); @@ -156,7 +156,7 @@ class CleanupRemoteStorages extends Command { $remoteShareIds = []; - while ($row = $result->fetch()) { + while ($row = $result->fetchAssociative()) { $cloudId = $this->cloudIdManager->getCloudId($row['owner'], $row['remote']); $remote = $cloudId->getRemote(); diff --git a/apps/files_sharing/lib/DeleteOrphanedSharesJob.php b/apps/files_sharing/lib/DeleteOrphanedSharesJob.php index 63f057e3bf4..42b80d885cc 100644 --- a/apps/files_sharing/lib/DeleteOrphanedSharesJob.php +++ b/apps/files_sharing/lib/DeleteOrphanedSharesJob.php @@ -13,7 +13,6 @@ use OCP\AppFramework\Utility\ITimeFactory; use OCP\BackgroundJob\TimedJob; use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\IDBConnection; -use PDO; use Psr\Log\LoggerInterface; use function array_map; @@ -82,7 +81,7 @@ class DeleteOrphanedSharesJob extends TimedJob { do { $deleted = $this->atomic(function () use ($qbSelect, $deleteQb) { $result = $qbSelect->executeQuery(); - $ids = array_map('intval', $result->fetchAll(PDO::FETCH_COLUMN)); + $ids = array_map('intval', $result->fetchFirstColumn()); $result->closeCursor(); $deleteQb->setParameter('ids', $ids, IQueryBuilder::PARAM_INT_ARRAY); $deleted = $deleteQb->executeStatement(); @@ -99,7 +98,7 @@ class DeleteOrphanedSharesJob extends TimedJob { $qb = $this->db->getQueryBuilder(); $qb->selectDistinct('file_source') ->from('share', 's'); - $sourceFiles = $qb->executeQuery()->fetchAll(PDO::FETCH_COLUMN); + $sourceFiles = $qb->executeQuery()->fetchFirstColumn(); $deleteQb = $this->db->getQueryBuilder(); $deleteQb->delete('share') @@ -127,7 +126,7 @@ class DeleteOrphanedSharesJob extends TimedJob { $qb->select('fileid') ->from('filecache') ->where($qb->expr()->in('fileid', $qb->createNamedParameter($ids, IQueryBuilder::PARAM_INT_ARRAY))); - $found = $qb->executeQuery()->fetchAll(\PDO::FETCH_COLUMN); + $found = $qb->executeQuery()->fetchFirstColumn(); return array_diff($ids, $found); } } diff --git a/apps/files_sharing/lib/ExpireSharesJob.php b/apps/files_sharing/lib/ExpireSharesJob.php index b1c6c592e80..c72048e0e1e 100644 --- a/apps/files_sharing/lib/ExpireSharesJob.php +++ b/apps/files_sharing/lib/ExpireSharesJob.php @@ -58,7 +58,7 @@ class ExpireSharesJob extends TimedJob { ); $shares = $qb->executeQuery(); - while ($share = $shares->fetch()) { + while ($share = $shares->fetchAssociative()) { if ((int)$share['share_type'] === IShare::TYPE_LINK) { $id = 'ocinternal'; } elseif ((int)$share['share_type'] === IShare::TYPE_EMAIL) { diff --git a/apps/files_sharing/lib/External/Manager.php b/apps/files_sharing/lib/External/Manager.php index 3f87153d5da..43cd7f8d125 100644 --- a/apps/files_sharing/lib/External/Manager.php +++ b/apps/files_sharing/lib/External/Manager.php @@ -160,7 +160,7 @@ class Manager { ->from('share_external') ->where($qb->expr()->eq('id', $qb->createNamedParameter($id, IQueryBuilder::PARAM_INT))) ->executeQuery(); - $share = $result->fetch(); + $share = $result->fetchAssociative(); $result->closeCursor(); return $share; } @@ -177,7 +177,7 @@ class Manager { ->from('share_external') ->where($qb->expr()->eq('share_token', $qb->createNamedParameter($token, IQueryBuilder::PARAM_STR))) ->executeQuery(); - $share = $result->fetch(); + $share = $result->fetchAssociative(); $result->closeCursor(); return $share; } @@ -191,7 +191,7 @@ class Manager { $qb->expr()->eq('user', $qb->createNamedParameter($uid, IQueryBuilder::PARAM_STR)), )) ->executeQuery(); - $share = $result->fetch(); + $share = $result->fetchAssociative(); $result->closeCursor(); if ($share !== false) { return $share; @@ -621,7 +621,7 @@ class Manager { ->where($qb->expr()->eq('mountpoint_hash', $qb->createNamedParameter($hash))) ->andWhere($qb->expr()->eq('user', $qb->createNamedParameter($this->uid))); $result = $qb->executeQuery(); - $share = $result->fetch(); + $share = $result->fetchAssociative(); $result->closeCursor(); if ($share !== false && (int)$share['share_type'] === IShare::TYPE_USER) { try { @@ -681,7 +681,7 @@ class Manager { ->where($qb->expr()->eq('user', $qb->createNamedParameter($uid))) ->andWhere($qb->expr()->eq('share_type', $qb->createNamedParameter(IShare::TYPE_USER))); $result = $qb->executeQuery(); - $shares = $result->fetchAll(); + $shares = $result->fetchAllAssociative(); $result->closeCursor(); foreach ($shares as $share) { @@ -720,7 +720,7 @@ class Manager { ->where($qb->expr()->eq('user', $qb->createNamedParameter($gid))) ->andWhere($qb->expr()->eq('share_type', $qb->createNamedParameter(IShare::TYPE_GROUP))); $result = $qb->executeQuery(); - $shares = $result->fetchAll(); + $shares = $result->fetchAllAssociative(); $result->closeCursor(); $deletedGroupShares = []; @@ -799,7 +799,8 @@ class Manager { try { $result = $qb->executeQuery(); - $shares = $result->fetchAll(); + /** @var list $shares */ + $shares = $result->fetchAllAssociative(); $result->closeCursor(); // remove parent group share entry if we have a specific user share entry for the user diff --git a/apps/files_sharing/lib/External/MountProvider.php b/apps/files_sharing/lib/External/MountProvider.php index a5781d5d35a..a1b8092d032 100644 --- a/apps/files_sharing/lib/External/MountProvider.php +++ b/apps/files_sharing/lib/External/MountProvider.php @@ -57,7 +57,7 @@ class MountProvider implements IMountProvider { ->andWhere($qb->expr()->eq('accepted', $qb->createNamedParameter(1, IQueryBuilder::PARAM_INT))); $result = $qb->executeQuery(); $mounts = []; - while ($row = $result->fetch()) { + while ($row = $result->fetchAssociative()) { $row['manager'] = $this; $row['token'] = $row['share_token']; $mounts[] = $this->getMount($user, $row, $loader); diff --git a/apps/files_sharing/lib/OrphanHelper.php b/apps/files_sharing/lib/OrphanHelper.php index ca8c198667b..37505e46a44 100644 --- a/apps/files_sharing/lib/OrphanHelper.php +++ b/apps/files_sharing/lib/OrphanHelper.php @@ -68,7 +68,7 @@ class OrphanHelper { } $result = $query->executeQuery(); - while ($row = $result->fetch()) { + while ($row = $result->fetchAssociative()) { yield [ 'id' => (int)$row['id'], 'owner' => (string)$row['uid_owner'], diff --git a/apps/files_sharing/lib/ShareBackend/File.php b/apps/files_sharing/lib/ShareBackend/File.php index 2aa52ef1b7f..28835a8d0eb 100644 --- a/apps/files_sharing/lib/ShareBackend/File.php +++ b/apps/files_sharing/lib/ShareBackend/File.php @@ -191,7 +191,7 @@ class File implements Share_Backend_File_Dependent { $qb->expr()->eq('id', $qb->createNamedParameter($parent)) ); $result = $qb->executeQuery(); - $item = $result->fetch(); + $item = $result->fetchAssociative(); $result->closeCursor(); if (isset($item['parent'])) { $parent = $item['parent']; diff --git a/apps/files_sharing/lib/ShareBackend/Folder.php b/apps/files_sharing/lib/ShareBackend/Folder.php index 35dc0da3c24..ee288f30772 100644 --- a/apps/files_sharing/lib/ShareBackend/Folder.php +++ b/apps/files_sharing/lib/ShareBackend/Folder.php @@ -24,7 +24,7 @@ class Folder extends File implements Share_Backend_Collection { ); $result = $qb->executeQuery(); - if (($row = $result->fetch()) !== false) { + if (($row = $result->fetchAssociative()) !== false) { $mimetype = (int)$row['id']; } else { $mimetype = -1; @@ -47,7 +47,7 @@ class Folder extends File implements Share_Backend_Collection { $result = $qb->executeQuery(); $parents = []; - while ($file = $result->fetch()) { + foreach ($result->iterateAssociative() as $file) { $children[] = ['source' => $file['fileid'], 'file_path' => $file['name']]; // If a child folder is found look inside it if ((int)$file['mimetype'] === $mimetype) { diff --git a/apps/files_sharing/lib/SharedMount.php b/apps/files_sharing/lib/SharedMount.php index 692a6c8979b..7dc95533d74 100644 --- a/apps/files_sharing/lib/SharedMount.php +++ b/apps/files_sharing/lib/SharedMount.php @@ -255,7 +255,7 @@ class SharedMount extends MountPoint implements MoveableMount, ISharedMountPoint ->where($builder->expr()->eq('fileid', $builder->createNamedParameter($this->getStorageRootId()))); $result = $query->executeQuery(); - $row = $result->fetch(); + $row = $result->fetchAssociative(); $result->closeCursor(); if ($row) { return (int)$row['storage']; diff --git a/apps/files_sharing/lib/SharesReminderJob.php b/apps/files_sharing/lib/SharesReminderJob.php index 854ad196d6b..dcf65b84823 100644 --- a/apps/files_sharing/lib/SharesReminderJob.php +++ b/apps/files_sharing/lib/SharesReminderJob.php @@ -132,11 +132,11 @@ class SharesReminderJob extends TimedJob { ) ->setMaxResults(SharesReminderJob::CHUNK_SIZE); - $shares = $qb->executeQuery()->fetchAll(); - return array_values(array_map(fn ($share): array => [ + $shares = $qb->executeQuery()->fetchAllAssociative(); + return array_map(fn ($share): array => [ 'id' => (int)$share['id'], 'share_type' => (int)$share['share_type'], - ], $shares)); + ], $shares); } /** @@ -171,12 +171,12 @@ class SharesReminderJob extends TimedJob { ) ); - $shares = $qb->executeQuery()->fetchAll(); - $shares = array_values(array_map(fn ($share): array => [ + $shares = $qb->executeQuery()->fetchAllAssociative(); + $shares = array_map(fn ($share): array => [ 'id' => (int)$share['id'], 'share_type' => (int)$share['share_type'], 'file_source' => (int)$share['file_source'], - ], $shares)); + ], $shares); return $this->filterSharesWithEmptyFolders($shares, self::CHUNK_SIZE); } @@ -198,7 +198,7 @@ class SharesReminderJob extends TimedJob { $chunkFileIds = array_map(fn ($share): int => $share['file_source'], $chunk); $chunkByFileId = array_combine($chunkFileIds, $chunk); $query->setParameter('fileids', $chunkFileIds, IQueryBuilder::PARAM_INT_ARRAY); - $chunkResults = $query->executeQuery()->fetchAll(\PDO::FETCH_COLUMN); + $chunkResults = $query->executeQuery()->fetchFirstColumn(); foreach ($chunkResults as $folderId) { $results[] = $chunkByFileId[$folderId]; } diff --git a/apps/files_sharing/tests/DeleteOrphanedSharesJobTest.php b/apps/files_sharing/tests/DeleteOrphanedSharesJobTest.php index 820c5e107f1..9e01f5cd4ad 100644 --- a/apps/files_sharing/tests/DeleteOrphanedSharesJobTest.php +++ b/apps/files_sharing/tests/DeleteOrphanedSharesJobTest.php @@ -105,7 +105,7 @@ class DeleteOrphanedSharesJobTest extends \Test\TestCase { private function getShares() { $shares = []; $result = $this->connection->executeQuery('SELECT * FROM `*PREFIX*share`'); - while ($row = $result->fetch()) { + while ($row = $result->fetchAssociative()) { $shares[] = $row; } $result->closeCursor(); diff --git a/apps/files_sharing/tests/ExpireSharesJobTest.php b/apps/files_sharing/tests/ExpireSharesJobTest.php index e6db2424176..00defc040bb 100644 --- a/apps/files_sharing/tests/ExpireSharesJobTest.php +++ b/apps/files_sharing/tests/ExpireSharesJobTest.php @@ -85,7 +85,7 @@ class ExpireSharesJobTest extends \Test\TestCase { ->from('share') ->executeQuery(); - while ($row = $result->fetch()) { + while ($row = $result->fetchAssociative()) { $shares[] = $row; } $result->closeCursor(); diff --git a/apps/files_sharing/tests/Migration/SetPasswordColumnTest.php b/apps/files_sharing/tests/Migration/SetPasswordColumnTest.php index 120b0318e58..9afa188cbc7 100644 --- a/apps/files_sharing/tests/Migration/SetPasswordColumnTest.php +++ b/apps/files_sharing/tests/Migration/SetPasswordColumnTest.php @@ -91,7 +91,7 @@ class SetPasswordColumnTest extends TestCase { $query->select('*') ->from('share'); $result = $query->executeQuery(); - $allShares = $result->fetchAll(); + $allShares = $result->fetchAllAssociative(); $result->closeCursor(); foreach ($allShares as $share) { diff --git a/apps/files_trashbin/lib/Trashbin.php b/apps/files_trashbin/lib/Trashbin.php index 15d5cd73a12..dfe7d6c03d0 100644 --- a/apps/files_trashbin/lib/Trashbin.php +++ b/apps/files_trashbin/lib/Trashbin.php @@ -112,7 +112,7 @@ class Trashbin implements IEventListener { ->where($query->expr()->eq('user', $query->createNamedParameter($user))); $result = $query->executeQuery(); $array = []; - while ($row = $result->fetch()) { + foreach ($result->iterateAssociative() as $row) { $array[$row['id']][$row['timestamp']] = [ 'location' => (string)$row['location'], 'deletedBy' => (string)$row['deleted_by'], @@ -139,7 +139,7 @@ class Trashbin implements IEventListener { ->andWhere($query->expr()->eq('timestamp', $query->createNamedParameter($timestamp))); $result = $query->executeQuery(); - $row = $result->fetch(); + $row = $result->fetchAssociative(); $result->closeCursor(); if (isset($row['location'])) { @@ -1017,7 +1017,7 @@ class Trashbin implements IEventListener { ->andWhere($query->expr()->iLike('name', $query->createNamedParameter($pattern))); $result = $query->executeQuery(); - $entries = $result->fetchAll(); + $entries = $result->fetchAllAssociative(); $result->closeCursor(); /** @var CacheEntry[] $matches */ diff --git a/apps/files_trashbin/tests/Command/CleanUpTest.php b/apps/files_trashbin/tests/Command/CleanUpTest.php index b8c98110da9..dd0352a6a19 100644 --- a/apps/files_trashbin/tests/Command/CleanUpTest.php +++ b/apps/files_trashbin/tests/Command/CleanUpTest.php @@ -65,7 +65,7 @@ class CleanUpTest extends TestCase { $result = $getAllQuery->select('id') ->from($this->trashTable) ->executeQuery() - ->fetchAll(); + ->fetchAllAssociative(); $this->assertCount(10, $result); } @@ -97,7 +97,7 @@ class CleanUpTest extends TestCase { ->from($this->trashTable); $qResult = $query->executeQuery(); - $result = $qResult->fetchAll(); + $result = $qResult->fetchAllAssociative(); $qResult->closeCursor(); $this->assertCount(5, $result); @@ -111,7 +111,7 @@ class CleanUpTest extends TestCase { $result = $getAllQuery->select('id') ->from($this->trashTable) ->executeQuery() - ->fetchAll(); + ->fetchAllAssociative(); $this->assertCount(10, $result); } } diff --git a/apps/files_versions/lib/Db/VersionsMapper.php b/apps/files_versions/lib/Db/VersionsMapper.php index 318dd8f0d82..5ee997a3c26 100644 --- a/apps/files_versions/lib/Db/VersionsMapper.php +++ b/apps/files_versions/lib/Db/VersionsMapper.php @@ -95,7 +95,7 @@ class VersionsMapper extends QBMapper { $filesIdsSelect->setParameter('offset', $offset, IQueryBuilder::PARAM_INT); $result = $filesIdsSelect->executeQuery(); - $fileIds = $result->fetchAll(\PDO::FETCH_COLUMN); + $fileIds = $result->fetchFirstColumn(); $offset = end($fileIds); yield $fileIds; diff --git a/apps/oauth2/lib/Migration/SetTokenExpiration.php b/apps/oauth2/lib/Migration/SetTokenExpiration.php index dc925e26bb2..428153b51bc 100644 --- a/apps/oauth2/lib/Migration/SetTokenExpiration.php +++ b/apps/oauth2/lib/Migration/SetTokenExpiration.php @@ -36,7 +36,7 @@ class SetTokenExpiration implements IRepairStep { $cursor = $qb->executeQuery(); - while ($row = $cursor->fetch()) { + while ($row = $cursor->fetchAssociative()) { $token = AccessToken::fromRow($row); try { $appToken = $this->tokenProvider->getTokenById($token->getTokenId()); diff --git a/apps/oauth2/lib/Migration/Version011601Date20230522143227.php b/apps/oauth2/lib/Migration/Version011601Date20230522143227.php index f2998202e02..d206915f861 100644 --- a/apps/oauth2/lib/Migration/Version011601Date20230522143227.php +++ b/apps/oauth2/lib/Migration/Version011601Date20230522143227.php @@ -52,7 +52,7 @@ class Version011601Date20230522143227 extends SimpleMigrationStep { $qbSelect->select('id', 'secret') ->from('oauth2_clients'); $req = $qbSelect->executeQuery(); - while ($row = $req->fetch()) { + while ($row = $req->fetchAssociative()) { $id = $row['id']; $secret = $row['secret']; $encryptedSecret = $this->crypto->encrypt($secret); diff --git a/apps/oauth2/lib/Migration/Version011901Date20240829164356.php b/apps/oauth2/lib/Migration/Version011901Date20240829164356.php index 20f5754bf11..3e97b29fdd1 100644 --- a/apps/oauth2/lib/Migration/Version011901Date20240829164356.php +++ b/apps/oauth2/lib/Migration/Version011901Date20240829164356.php @@ -35,7 +35,7 @@ class Version011901Date20240829164356 extends SimpleMigrationStep { $qbSelect->select('id', 'secret') ->from('oauth2_clients'); $req = $qbSelect->executeQuery(); - while ($row = $req->fetch()) { + while ($row = $req->fetchAssociative()) { $id = $row['id']; $storedEncryptedSecret = $row['secret']; $secret = $this->crypto->decrypt($storedEncryptedSecret); diff --git a/apps/settings/lib/Settings/Admin/Server.php b/apps/settings/lib/Settings/Admin/Server.php index c142c26dbd6..02a6cd2736b 100644 --- a/apps/settings/lib/Settings/Admin/Server.php +++ b/apps/settings/lib/Settings/Admin/Server.php @@ -70,7 +70,7 @@ class Server implements IDelegatedSettings { ->setMaxResults(1); $result = $query->executeQuery(); - if ($row = $result->fetch()) { + if ($row = $result->fetchAssociative()) { $maxAge = (int)$row['last_checked']; } else { $maxAge = $this->timeFactory->getTime(); diff --git a/apps/settings/lib/SetupChecks/SupportedDatabase.php b/apps/settings/lib/SetupChecks/SupportedDatabase.php index 27e9b1f7772..5c75ba81462 100644 --- a/apps/settings/lib/SetupChecks/SupportedDatabase.php +++ b/apps/settings/lib/SetupChecks/SupportedDatabase.php @@ -43,7 +43,7 @@ class SupportedDatabase implements ISetupCheck { if ($databasePlatform === IDBConnection::PLATFORM_MYSQL || $databasePlatform === IDBConnection::PLATFORM_MARIADB) { $statement = $this->connection->prepare("SHOW VARIABLES LIKE 'version';"); $result = $statement->execute(); - $row = $result->fetch(); + $row = $result->fetchAssociative(); $version = $row['Value']; $versionlc = strtolower($version); // we only care about X.Y not X.Y.Z differences @@ -89,7 +89,7 @@ class SupportedDatabase implements ISetupCheck { } elseif ($databasePlatform === IDBConnection::PLATFORM_POSTGRES) { $statement = $this->connection->prepare('SHOW server_version;'); $result = $statement->execute(); - $row = $result->fetch(); + $row = $result->fetchAssociative(); $version = $row['server_version']; $versionlc = strtolower($version); // we only care about X not X.Y or X.Y.Z differences diff --git a/apps/sharebymail/lib/ShareByMailProvider.php b/apps/sharebymail/lib/ShareByMailProvider.php index c443459a712..16e3068b15b 100644 --- a/apps/sharebymail/lib/ShareByMailProvider.php +++ b/apps/sharebymail/lib/ShareByMailProvider.php @@ -650,7 +650,7 @@ class ShareByMailProvider extends DefaultShareProvider implements IShareProvider ->orderBy('id'); $cursor = $qb->executeQuery(); - while ($data = $cursor->fetch()) { + while ($data = $cursor->fetchAssociative()) { $children[] = $this->createShareObject($data); } $cursor->closeCursor(); @@ -845,7 +845,7 @@ class ShareByMailProvider extends DefaultShareProvider implements IShareProvider $cursor = $qb->executeQuery(); $shares = []; - while ($data = $cursor->fetch()) { + while ($data = $cursor->fetchAssociative()) { $shares[] = $this->createShareObject($data); } $cursor->closeCursor(); @@ -865,7 +865,7 @@ class ShareByMailProvider extends DefaultShareProvider implements IShareProvider ->andWhere($qb->expr()->eq('share_type', $qb->createNamedParameter(IShare::TYPE_EMAIL))); $cursor = $qb->executeQuery(); - $data = $cursor->fetch(); + $data = $cursor->fetchAssociative(); $cursor->closeCursor(); if ($data === false) { @@ -896,7 +896,7 @@ class ShareByMailProvider extends DefaultShareProvider implements IShareProvider ->executeQuery(); $shares = []; - while ($data = $cursor->fetch()) { + while ($data = $cursor->fetchAssociative()) { $shares[] = $this->createShareObject($data); } $cursor->closeCursor(); @@ -935,7 +935,7 @@ class ShareByMailProvider extends DefaultShareProvider implements IShareProvider $cursor = $qb->executeQuery(); - while ($data = $cursor->fetch()) { + while ($data = $cursor->fetchAssociative()) { $shares[] = $this->createShareObject($data); } $cursor->closeCursor(); @@ -958,7 +958,7 @@ class ShareByMailProvider extends DefaultShareProvider implements IShareProvider ->andWhere($qb->expr()->eq('token', $qb->createNamedParameter($token))) ->executeQuery(); - $data = $cursor->fetch(); + $data = $cursor->fetchAssociative(); if ($data === false) { throw new ShareNotFound('Share not found', $this->l->t('Could not find share')); @@ -1099,7 +1099,7 @@ class ShareByMailProvider extends DefaultShareProvider implements IShareProvider ->where($qb->expr()->eq('id', $qb->createNamedParameter($id))); $cursor = $qb->executeQuery(); - $data = $cursor->fetch(); + $data = $cursor->fetchAssociative(); $cursor->closeCursor(); if ($data === false) { @@ -1153,7 +1153,7 @@ class ShareByMailProvider extends DefaultShareProvider implements IShareProvider $cursor = $qb->executeQuery(); $shares = []; - while ($data = $cursor->fetch()) { + while ($data = $cursor->fetchAssociative()) { $shares[$data['fileid']][] = $this->createShareObject($data); } $cursor->closeCursor(); @@ -1180,7 +1180,7 @@ class ShareByMailProvider extends DefaultShareProvider implements IShareProvider $public = false; $mail = []; - while ($row = $cursor->fetch()) { + while ($row = $cursor->fetchAssociative()) { $public = true; if ($currentAccess === false) { $mail[] = $row['share_with']; @@ -1208,7 +1208,7 @@ class ShareByMailProvider extends DefaultShareProvider implements IShareProvider ); $cursor = $qb->executeQuery(); - while ($data = $cursor->fetch()) { + while ($data = $cursor->fetchAssociative()) { try { $share = $this->createShareObject($data); } catch (InvalidShare $e) { diff --git a/apps/sharebymail/tests/ShareByMailProviderTest.php b/apps/sharebymail/tests/ShareByMailProviderTest.php index 68e7e8691fa..3386e55abd8 100644 --- a/apps/sharebymail/tests/ShareByMailProviderTest.php +++ b/apps/sharebymail/tests/ShareByMailProviderTest.php @@ -747,7 +747,7 @@ class ShareByMailProviderTest extends TestCase { ->where($qb->expr()->eq('id', $qb->createNamedParameter($id))); $qResult = $qb->executeQuery(); - $result = $qResult->fetchAll(); + $result = $qResult->fetchAllAssociative(); $qResult->closeCursor(); $this->assertSame(1, count($result)); @@ -800,7 +800,7 @@ class ShareByMailProviderTest extends TestCase { ->where($qb->expr()->eq('id', $qb->createNamedParameter($id))); $qResult = $qb->executeQuery(); - $result = $qResult->fetchAll(); + $result = $qResult->fetchAllAssociative(); $qResult->closeCursor(); $this->assertSame(1, count($result)); @@ -1032,7 +1032,7 @@ class ShareByMailProviderTest extends TestCase { ->where($query->expr()->eq('id', $query->createNamedParameter($id))); $result = $query->executeQuery(); - $before = $result->fetchAll(); + $before = $result->fetchAllAssociative(); $result->closeCursor(); $this->assertTrue(is_array($before)); @@ -1045,7 +1045,7 @@ class ShareByMailProviderTest extends TestCase { ->where($query->expr()->eq('id', $query->createNamedParameter($id))); $result = $query->executeQuery(); - $after = $result->fetchAll(); + $after = $result->fetchAllAssociative(); $result->closeCursor(); $this->assertTrue(is_array($after)); @@ -1068,7 +1068,7 @@ class ShareByMailProviderTest extends TestCase { $query->select('*')->from('share'); $result = $query->executeQuery(); - $before = $result->fetchAll(); + $before = $result->fetchAllAssociative(); $result->closeCursor(); $this->assertTrue(is_array($before)); @@ -1083,7 +1083,7 @@ class ShareByMailProviderTest extends TestCase { $query->select('*')->from('share'); $result = $query->executeQuery(); - $after = $result->fetchAll(); + $after = $result->fetchAllAssociative(); $result->closeCursor(); $this->assertTrue(is_array($after)); diff --git a/apps/theming/lib/Jobs/MigrateBackgroundImages.php b/apps/theming/lib/Jobs/MigrateBackgroundImages.php index 62e58f5e722..685e7c9cc8c 100644 --- a/apps/theming/lib/Jobs/MigrateBackgroundImages.php +++ b/apps/theming/lib/Jobs/MigrateBackgroundImages.php @@ -68,7 +68,7 @@ class MigrateBackgroundImages extends QueuedJob { ->andWhere($selector->expr()->eq('configvalue', $selector->createNamedParameter('custom', IQueryBuilder::PARAM_STR), IQueryBuilder::PARAM_STR)) ->executeQuery(); - $userIds = $result->fetchAll(\PDO::FETCH_COLUMN); + $userIds = $result->fetchFirstColumn(); $this->storeUserIdsToProcess($userIds); } catch (\Throwable $t) { $this->jobList->add(self::class, ['stage' => self::STAGE_PREPARE]); diff --git a/apps/theming/lib/Jobs/RestoreBackgroundImageColor.php b/apps/theming/lib/Jobs/RestoreBackgroundImageColor.php index 42662dacef2..a2b2778cc7d 100644 --- a/apps/theming/lib/Jobs/RestoreBackgroundImageColor.php +++ b/apps/theming/lib/Jobs/RestoreBackgroundImageColor.php @@ -75,7 +75,7 @@ class RestoreBackgroundImageColor extends QueuedJob { ->andWhere($qb2->expr()->isNull('b.userid')) ->executeQuery(); - $userIds = $result->fetchAll(\PDO::FETCH_COLUMN); + $userIds = $result->fetchFirstColumn(); $this->logger->info('Prepare to restore background information for {users} users', ['users' => count($userIds)]); $this->storeUserIdsToProcess($userIds); } catch (\Throwable $t) { diff --git a/apps/twofactor_backupcodes/lib/Migration/Version1002Date20170607113030.php b/apps/twofactor_backupcodes/lib/Migration/Version1002Date20170607113030.php index c880b3df78f..ad277d3b15b 100644 --- a/apps/twofactor_backupcodes/lib/Migration/Version1002Date20170607113030.php +++ b/apps/twofactor_backupcodes/lib/Migration/Version1002Date20170607113030.php @@ -55,7 +55,7 @@ class Version1002Date20170607113030 extends SimpleMigrationStep { $result = $query->executeQuery(); $output->startProgress(); - while ($row = $result->fetch()) { + while ($row = $result->fetchAssociative()) { $output->advance(); $insert diff --git a/apps/user_ldap/lib/Db/GroupMembershipMapper.php b/apps/user_ldap/lib/Db/GroupMembershipMapper.php index b3d6c31dda6..c81ee7010ae 100644 --- a/apps/user_ldap/lib/Db/GroupMembershipMapper.php +++ b/apps/user_ldap/lib/Db/GroupMembershipMapper.php @@ -30,7 +30,7 @@ class GroupMembershipMapper extends QBMapper { ->from($this->getTableName()) ->executeQuery(); - $groups = array_column($result->fetchAll(), 'groupid'); + $groups = array_column($result->fetchAllAssociative(), 'groupid'); $result->closeCursor(); return $groups; } diff --git a/apps/user_ldap/lib/Mapping/AbstractMapping.php b/apps/user_ldap/lib/Mapping/AbstractMapping.php index fdcc15535ea..338d49ad03b 100644 --- a/apps/user_ldap/lib/Mapping/AbstractMapping.php +++ b/apps/user_ldap/lib/Mapping/AbstractMapping.php @@ -98,7 +98,7 @@ abstract class AbstractMapping { ->from($this->getTableName()); $q->setMaxResults(self::LOCAL_CACHE_OBJECT_THRESHOLD + 1); $result = $q->executeQuery(); - $row = $result->fetch(); + $row = $result->fetchAssociative(); $result->closeCursor(); $use = (int)$row['count'] <= self::LOCAL_CACHE_OBJECT_THRESHOLD; @@ -275,7 +275,7 @@ abstract class AbstractMapping { protected function collectResultsFromListOfIdsQuery(IQueryBuilder $qb, array &$results): void { $stmt = $qb->executeQuery(); - while ($entry = $stmt->fetch(\Doctrine\DBAL\FetchMode::ASSOCIATIVE)) { + while ($entry = $stmt->fetchAssociative()) { $results[$entry['ldap_dn']] = $entry['owncloud_name']; $this->cache[$entry['ldap_dn']] = $entry['owncloud_name']; } @@ -345,7 +345,7 @@ abstract class AbstractMapping { return []; } $names = []; - while ($row = $res->fetch()) { + while ($row = $res->fetchAssociative()) { $names[] = $row['owncloud_name']; } return $names; @@ -390,7 +390,7 @@ abstract class AbstractMapping { } $result = $select->executeQuery(); - $entries = $result->fetchAll(); + $entries = $result->fetchAllAssociative(); $result->closeCursor(); return $entries; diff --git a/apps/user_ldap/lib/Migration/GroupMappingMigration.php b/apps/user_ldap/lib/Migration/GroupMappingMigration.php index 7dfb8705770..8bafff2f80d 100644 --- a/apps/user_ldap/lib/Migration/GroupMappingMigration.php +++ b/apps/user_ldap/lib/Migration/GroupMappingMigration.php @@ -35,7 +35,7 @@ abstract class GroupMappingMigration extends SimpleMigrationStep { $result = $query->executeQuery(); - while ($row = $result->fetch()) { + while ($row = $result->fetchAssociative()) { $insert ->setParameter('ldap_dn', $row['ldap_dn']) ->setParameter('owncloud_name', $row['owncloud_name']) diff --git a/apps/user_ldap/lib/Migration/Version1120Date20210917155206.php b/apps/user_ldap/lib/Migration/Version1120Date20210917155206.php index dc3823bf771..a6e071811e0 100644 --- a/apps/user_ldap/lib/Migration/Version1120Date20210917155206.php +++ b/apps/user_ldap/lib/Migration/Version1120Date20210917155206.php @@ -72,7 +72,7 @@ class Version1120Date20210917155206 extends SimpleMigrationStep { $update = $this->getUpdateQuery($table); $result = $select->executeQuery(); - while ($row = $result->fetch()) { + while ($row = $result->fetchAssociative()) { $newId = hash('sha256', $row['owncloud_name'], false); if ($emitHooks) { $this->emitUnassign($row['owncloud_name'], true); diff --git a/apps/user_ldap/lib/Migration/Version1130Date20211102154716.php b/apps/user_ldap/lib/Migration/Version1130Date20211102154716.php index 2457acd840d..406c1633fc8 100644 --- a/apps/user_ldap/lib/Migration/Version1130Date20211102154716.php +++ b/apps/user_ldap/lib/Migration/Version1130Date20211102154716.php @@ -137,7 +137,7 @@ class Version1130Date20211102154716 extends SimpleMigrationStep { $update = $this->getUpdateQuery($table); $result = $select->executeQuery(); - while ($row = $result->fetch()) { + while ($row = $result->fetchAssociative()) { $dnHash = hash('sha256', $row['ldap_dn'], false); $update->setParameter('name', $row['owncloud_name']); $update->setParameter('dn_hash', $dnHash); diff --git a/apps/user_ldap/lib/Migration/Version1190Date20230706134108.php b/apps/user_ldap/lib/Migration/Version1190Date20230706134108.php index 85b046ab7c9..7099712073f 100644 --- a/apps/user_ldap/lib/Migration/Version1190Date20230706134108.php +++ b/apps/user_ldap/lib/Migration/Version1190Date20230706134108.php @@ -80,7 +80,7 @@ class Version1190Date20230706134108 extends SimpleMigrationStep { ->from('ldap_group_members'); $result = $query->executeQuery(); - while ($row = $result->fetch()) { + while ($row = $result->fetchAssociative()) { $knownUsers = unserialize($row['owncloudusers']); if (!is_array($knownUsers)) { /* Unserialize failed or data was incorrect in database, ignore */ diff --git a/apps/workflowengine/lib/Manager.php b/apps/workflowengine/lib/Manager.php index c402f84c830..44d4c71b4f0 100644 --- a/apps/workflowengine/lib/Manager.php +++ b/apps/workflowengine/lib/Manager.php @@ -104,7 +104,7 @@ class Manager implements IManager { $result = $query->executeQuery(); $operations = []; - while ($row = $result->fetch()) { + while ($row = $result->fetchAssociative()) { $eventNames = \json_decode($row['events']); $operation = $row['class']; @@ -152,7 +152,7 @@ class Manager implements IManager { $result = $query->executeQuery(); $scopesByOperation[$operationClass] = []; - while ($row = $result->fetch()) { + while ($row = $result->fetchAssociative()) { $scope = new ScopeContext($row['type'], $row['value']); if (!$operation->isAvailableForScope((int)$row['type'])) { @@ -187,7 +187,7 @@ class Manager implements IManager { $result = $query->executeQuery(); $this->operations[$scopeContext->getHash()] = []; - while ($row = $result->fetch()) { + while ($row = $result->fetchAssociative()) { try { /** @var IOperation $operation */ $operation = $this->container->get($row['class']); @@ -226,7 +226,7 @@ class Manager implements IManager { ->from('flow_operations') ->where($query->expr()->eq('id', $query->createNamedParameter($id))); $result = $query->executeQuery(); - $row = $result->fetch(); + $row = $result->fetchAssociative(); $result->closeCursor(); if ($row) { @@ -540,7 +540,7 @@ class Manager implements IManager { ->where($query->expr()->in('id', $query->createNamedParameter($checkIds, IQueryBuilder::PARAM_INT_ARRAY))); $result = $query->executeQuery(); - while ($row = $result->fetch()) { + while ($row = $result->fetchAssociative()) { /** @var Check $row */ $this->checks[(int)$row['id']] = $row; $checks[(int)$row['id']] = $row; @@ -569,7 +569,7 @@ class Manager implements IManager { ->where($query->expr()->eq('hash', $query->createNamedParameter($hash))); $result = $query->executeQuery(); - if ($row = $result->fetch()) { + if ($row = $result->fetchAssociative()) { $result->closeCursor(); return (int)$row['id']; } diff --git a/build/psalm-baseline.xml b/build/psalm-baseline.xml index 71d9fe016a4..8a049d4b705 100644 --- a/build/psalm-baseline.xml +++ b/build/psalm-baseline.xml @@ -879,7 +879,6 @@ - @@ -2809,9 +2808,6 @@ - - - diff --git a/core/BackgroundJobs/MovePreviewJob.php b/core/BackgroundJobs/MovePreviewJob.php index e0a9d5b5517..1442b22b327 100644 --- a/core/BackgroundJobs/MovePreviewJob.php +++ b/core/BackgroundJobs/MovePreviewJob.php @@ -94,7 +94,7 @@ class MovePreviewJob extends TimedJob { $foundPreview = false; $fileIds = []; $flatFileIds = []; - while ($row = $result->fetch()) { + while ($row = $result->fetchAssociative()) { $pathSplit = explode('/', $row['path']); assert(count($pathSplit) >= 2); $fileId = (int)$pathSplit[count($pathSplit) - 2]; @@ -161,7 +161,7 @@ class MovePreviewJob extends TimedJob { ->setMaxResults(1); $result = $qb->executeQuery(); - $result = $result->fetchAll(); + $result = $result->fetchAllAssociative(); if (count($result) > 0) { foreach ($previewFiles as $previewFile) { diff --git a/core/Command/Db/ConvertType.php b/core/Command/Db/ConvertType.php index 2c74e9e517f..4e7e8c604f3 100644 --- a/core/Command/Db/ConvertType.php +++ b/core/Command/Db/ConvertType.php @@ -342,7 +342,7 @@ class ConvertType extends Command implements CompletionAwareInterface { try { $toDB->beginTransaction(); - while ($row = $result->fetch()) { + foreach ($result->iterateAssociative() as $row) { $progress->advance(); if (!$parametersCreated) { foreach ($row as $key => $value) { diff --git a/core/Command/Info/FileUtils.php b/core/Command/Info/FileUtils.php index bc07535a289..e106fc7a77a 100644 --- a/core/Command/Info/FileUtils.php +++ b/core/Command/Info/FileUtils.php @@ -253,7 +253,7 @@ class FileUtils { ->leftJoin('s', 'mounts', 'm', $query->expr()->eq('s.numeric_id', 'm.storage_id')) ->where($query->expr()->eq('s.numeric_id', $query->createNamedParameter($id, IQueryBuilder::PARAM_INT))) ->groupBy('s.numeric_id', 's.id', 's.available', 's.last_checked', 'mount_id'); - $row = $query->executeQuery()->fetch(); + $row = $query->executeQuery()->fetchAssociative(); if ($row) { return [ 'numeric_id' => $row['numeric_id'], @@ -286,7 +286,7 @@ class FileUtils { $query->setMaxResults($limit); } $result = $query->executeQuery(); - while ($row = $result->fetch()) { + while ($row = $result->fetchAssociative()) { yield [ 'numeric_id' => $row['numeric_id'], 'id' => $row['id'], diff --git a/core/Command/Maintenance/RepairShareOwnership.php b/core/Command/Maintenance/RepairShareOwnership.php index 16675545afe..6556d7ee707 100644 --- a/core/Command/Maintenance/RepairShareOwnership.php +++ b/core/Command/Maintenance/RepairShareOwnership.php @@ -92,7 +92,7 @@ class RepairShareOwnership extends Command { ->where($qb->expr()->neq('m.user_id', 's.uid_owner')) ->andWhere($qb->expr()->eq($qb->func()->concat($qb->expr()->literal('/'), 'm.user_id', $qb->expr()->literal('/')), 'm.mount_point')) ->executeQuery() - ->fetchAll(); + ->fetchAllAssociative(); $found = []; @@ -126,7 +126,7 @@ class RepairShareOwnership extends Command { ->andWhere($qb->expr()->eq($qb->func()->concat($qb->expr()->literal('/'), 'm.user_id', $qb->expr()->literal('/')), 'm.mount_point')) ->andWhere($qb->expr()->eq('s.share_with', $qb->createNamedParameter($user->getUID()))) ->executeQuery() - ->fetchAll(); + ->fetchAllAssociative(); $found = []; diff --git a/core/Migrations/Version13000Date20170718121200.php b/core/Migrations/Version13000Date20170718121200.php index ed8c57f52e5..9c58ba18b51 100644 --- a/core/Migrations/Version13000Date20170718121200.php +++ b/core/Migrations/Version13000Date20170718121200.php @@ -1017,7 +1017,7 @@ class Version13000Date20170718121200 extends SimpleMigrationStep { ->setValue('propertyvalue', $insert->createParameter('propertyvalue')) ->setValue('userid', $insert->createParameter('userid')); - while ($row = $result->fetch()) { + while ($row = $result->fetchAssociative()) { preg_match('/(calendar)\/([A-z0-9-@_]+)\//', $row['propertypath'], $match); $insert->setParameter('propertypath', (string)$row['propertypath']) ->setParameter('propertyname', (string)$row['propertyname']) diff --git a/core/Migrations/Version20000Date20201109081918.php b/core/Migrations/Version20000Date20201109081918.php index f85c34f47a2..6ae20c11035 100644 --- a/core/Migrations/Version20000Date20201109081918.php +++ b/core/Migrations/Version20000Date20201109081918.php @@ -78,7 +78,7 @@ class Version20000Date20201109081918 extends SimpleMigrationStep { ->setValue('credentials', $insert->createParameter('credentials')); $result = $query->executeQuery(); - while ($row = $result->fetch()) { + while ($row = $result->fetchAssociative()) { $insert->setParameter('user', (string)$row['user']) ->setParameter('identifier', (string)$row['identifier']) ->setParameter('credentials', (string)$row['credentials']); diff --git a/core/Migrations/Version28000Date20240828142927.php b/core/Migrations/Version28000Date20240828142927.php index e36c27add1c..30382e778d3 100644 --- a/core/Migrations/Version28000Date20240828142927.php +++ b/core/Migrations/Version28000Date20240828142927.php @@ -63,7 +63,7 @@ class Version28000Date20240828142927 extends SimpleMigrationStep { ->setFirstResult($offset) ->executeQuery(); - $jobs = $result->fetchAll(); + $jobs = $result->fetchAllAssociative(); $count = count($jobs); foreach ($jobs as $jobRow) { diff --git a/core/Migrations/Version32000Date20250731062008.php b/core/Migrations/Version32000Date20250731062008.php index 5976be55a54..3068c47caa1 100644 --- a/core/Migrations/Version32000Date20250731062008.php +++ b/core/Migrations/Version32000Date20250731062008.php @@ -61,7 +61,7 @@ class Version32000Date20250731062008 extends SimpleMigrationStep { $seen = []; $duplicateCount = 0; - while ($category = $result->fetch()) { + while ($category = $result->fetchAssociative()) { $key = $category['uid'] . '|' . $category['type'] . '|' . $category['category']; $categoryId = (int)$category['id']; @@ -135,7 +135,7 @@ class Version32000Date20250731062008 extends SimpleMigrationStep { $duplicatedAssignments = $selectQb->executeQuery(); $count = 0; - while ($row = $duplicatedAssignments->fetch()) { + while ($row = $duplicatedAssignments->fetchAssociative()) { $deleteQb ->setParameters($row) ->executeStatement(); diff --git a/core/Migrations/Version33000Date20251023120529.php b/core/Migrations/Version33000Date20251023120529.php index bcc6d691a7a..5c04b394208 100644 --- a/core/Migrations/Version33000Date20251023120529.php +++ b/core/Migrations/Version33000Date20251023120529.php @@ -50,7 +50,7 @@ class Version33000Date20251023120529 extends SimpleMigrationStep { $set = []; - while ($row = $result->fetch()) { + while ($row = $result->fetchAssociative()) { // Iterate over all the rows with duplicated rows $id = $row['id']; @@ -65,7 +65,7 @@ class Version33000Date20251023120529 extends SimpleMigrationStep { ->andWhere($qb->expr()->neq('id', $qb->createNamedParameter($authoritativeId))); $result = $qb->executeQuery(); - while ($row = $result->fetch()) { + while ($row = $result->fetchAssociative()) { // Update previews entries to the now de-duplicated id $qb = $this->connection->getQueryBuilder(); $qb->update('previews') diff --git a/tests/lib/AllConfigTest.php b/tests/lib/AllConfigTest.php index 9c1020028b0..9eb0fc832a3 100644 --- a/tests/lib/AllConfigTest.php +++ b/tests/lib/AllConfigTest.php @@ -54,7 +54,7 @@ class AllConfigTest extends \Test\TestCase { $result = $this->connection->executeQuery( 'SELECT COUNT(*) AS `count` FROM `*PREFIX*preferences` WHERE `userid` = ?', ['userDelete'] - )->fetch(); + )->fetchAssociative(); $actualCount = $result['count']; $this->assertEquals(0, $actualCount, 'There was one value in the database and after the tests there should be no entry left.'); @@ -66,7 +66,7 @@ class AllConfigTest extends \Test\TestCase { $config->setUserValue('userSet', 'appSet', 'keySet', 'valueSet'); - $result = $this->connection->executeQuery($selectAllSQL, ['userSet'])->fetchAll(); + $result = $this->connection->executeQuery($selectAllSQL, ['userSet'])->fetchAllAssociative(); $this->assertEquals(1, count($result)); $this->assertEquals([ @@ -79,7 +79,7 @@ class AllConfigTest extends \Test\TestCase { // test if the method overwrites existing database entries $config->setUserValue('userSet', 'appSet', 'keySet', 'valueSet2'); - $result = $this->connection->executeQuery($selectAllSQL, ['userSet'])->fetchAll(); + $result = $this->connection->executeQuery($selectAllSQL, ['userSet'])->fetchAllAssociative(); $this->assertEquals(1, count($result)); $this->assertEquals([ @@ -103,7 +103,7 @@ class AllConfigTest extends \Test\TestCase { $config->setUserValue('userSet', 'settings', 'email', 'mixed.CASE@domain.COM'); - $result = $this->connection->executeQuery($selectAllSQL, ['userSet'])->fetchAll(); + $result = $this->connection->executeQuery($selectAllSQL, ['userSet'])->fetchAllAssociative(); $this->assertEquals(1, count($result)); $this->assertEquals([ @@ -121,7 +121,7 @@ class AllConfigTest extends \Test\TestCase { $config->setUserValue('userPreCond', 'appPreCond', 'keyPreCond', 'valuePreCond'); - $result = $this->connection->executeQuery($selectAllSQL, ['userPreCond'])->fetchAll(); + $result = $this->connection->executeQuery($selectAllSQL, ['userPreCond'])->fetchAllAssociative(); $this->assertEquals(1, count($result)); $this->assertEquals([ @@ -134,7 +134,7 @@ class AllConfigTest extends \Test\TestCase { // test if the method overwrites existing database entries with valid precond $config->setUserValue('userPreCond', 'appPreCond', 'keyPreCond', 'valuePreCond2', 'valuePreCond'); - $result = $this->connection->executeQuery($selectAllSQL, ['userPreCond'])->fetchAll(); + $result = $this->connection->executeQuery($selectAllSQL, ['userPreCond'])->fetchAllAssociative(); $this->assertEquals(1, count($result)); $this->assertEquals([ @@ -178,7 +178,7 @@ class AllConfigTest extends \Test\TestCase { $config->setUserValue('userPreCond1', 'appPreCond', 'keyPreCond', 'valuePreCond'); - $result = $this->connection->executeQuery($selectAllSQL, ['userPreCond1'])->fetchAll(); + $result = $this->connection->executeQuery($selectAllSQL, ['userPreCond1'])->fetchAllAssociative(); $this->assertEquals(1, count($result)); $this->assertEquals([ @@ -191,7 +191,7 @@ class AllConfigTest extends \Test\TestCase { // test if the method overwrites existing database entries with valid precond $config->setUserValue('userPreCond1', 'appPreCond', 'keyPreCond', 'valuePreCond2', 'valuePreCond3'); - $result = $this->connection->executeQuery($selectAllSQL, ['userPreCond1'])->fetchAll(); + $result = $this->connection->executeQuery($selectAllSQL, ['userPreCond1'])->fetchAllAssociative(); $this->assertEquals(1, count($result)); $this->assertEquals([ @@ -214,7 +214,7 @@ class AllConfigTest extends \Test\TestCase { $config->setUserValue('userPreCond1', 'appPreCond', 'keyPreCond', 'valuePreCond'); - $result = $this->connection->executeQuery($selectAllSQL, ['userPreCond1'])->fetchAll(); + $result = $this->connection->executeQuery($selectAllSQL, ['userPreCond1'])->fetchAllAssociative(); $this->assertCount(1, $result); $this->assertEquals([ @@ -227,7 +227,7 @@ class AllConfigTest extends \Test\TestCase { // test if the method throws with invalid precondition when the value is the same $config->setUserValue('userPreCond1', 'appPreCond', 'keyPreCond', 'valuePreCond', 'valuePreCond3'); - $result = $this->connection->executeQuery($selectAllSQL, ['userPreCond1'])->fetchAll(); + $result = $this->connection->executeQuery($selectAllSQL, ['userPreCond1'])->fetchAllAssociative(); $this->assertCount(1, $result); $this->assertEquals([ @@ -278,7 +278,7 @@ class AllConfigTest extends \Test\TestCase { $result = $this->connection->executeQuery( 'SELECT `userid`, `appid`, `configkey`, `configvalue` FROM `*PREFIX*preferences` WHERE `userid` = ?', ['userGet'] - )->fetchAll(); + )->fetchAllAssociative(); $this->assertEquals(1, count($result)); $this->assertEquals([ @@ -299,7 +299,7 @@ class AllConfigTest extends \Test\TestCase { $result = $this->connection->executeQuery( 'SELECT `userid`, `appid`, `configkey`, `configvalue` FROM `*PREFIX*preferences` WHERE `userid` = ?', ['userGet'] - )->fetchAll(); + )->fetchAllAssociative(); $this->assertEquals(0, count($result)); } @@ -434,7 +434,7 @@ class AllConfigTest extends \Test\TestCase { $result = $this->connection->executeQuery( 'SELECT COUNT(*) AS `count` FROM `*PREFIX*preferences`' - )->fetch(); + )->fetchAssociative(); $actualCount = $result['count']; $this->assertEquals(1, $actualCount, 'After removing `userFetch3` there should be exactly 1 entry left.'); @@ -468,7 +468,7 @@ class AllConfigTest extends \Test\TestCase { $result = $this->connection->executeQuery( 'SELECT COUNT(*) AS `count` FROM `*PREFIX*preferences`' - )->fetch(); + )->fetchAssociative(); $actualCount = $result['count']; $this->assertEquals(4, $actualCount, 'After removing `appFetch1` there should be exactly 4 entries left.'); @@ -477,7 +477,7 @@ class AllConfigTest extends \Test\TestCase { $result = $this->connection->executeQuery( 'SELECT COUNT(*) AS `count` FROM `*PREFIX*preferences`' - )->fetch(); + )->fetchAssociative(); $actualCount = $result['count']; $this->assertEquals(2, $actualCount, 'After removing `appFetch2` there should be exactly 2 entries left.'); diff --git a/tests/lib/AppConfigIntegrationTest.php b/tests/lib/AppConfigIntegrationTest.php index 7259acb10c5..b0e400dd9e3 100644 --- a/tests/lib/AppConfigIntegrationTest.php +++ b/tests/lib/AppConfigIntegrationTest.php @@ -115,7 +115,7 @@ class AppConfigIntegrationTest extends TestCase { $sql->select('*') ->from('appconfig'); $result = $sql->executeQuery(); - $this->originalConfig = $result->fetchAll(); + $this->originalConfig = $result->fetchAllAssociative(); $result->closeCursor(); $sql = $this->connection->getQueryBuilder(); diff --git a/tests/lib/Authentication/Token/PublicKeyTokenMapperTest.php b/tests/lib/Authentication/Token/PublicKeyTokenMapperTest.php index 2f99024e0f4..d64c2dde81d 100644 --- a/tests/lib/Authentication/Token/PublicKeyTokenMapperTest.php +++ b/tests/lib/Authentication/Token/PublicKeyTokenMapperTest.php @@ -116,7 +116,7 @@ class PublicKeyTokenMapperTest extends TestCase { $result = $qb->select($qb->func()->count('*', 'count')) ->from('authtoken') ->executeQuery() - ->fetch(); + ->fetchAssociative(); return (int)$result['count']; } @@ -239,7 +239,7 @@ class PublicKeyTokenMapperTest extends TestCase { ->from('authtoken') ->where($qb->expr()->eq('token', $qb->createNamedParameter('9c5a2e661482b65597408a6bb6c4a3d1af36337381872ac56e445a06cdb7fea2b1039db707545c11027a4966919918b19d875a8b774840b18c6cbb7ae56fe206'))); $result = $qb->executeQuery(); - $id = $result->fetch()['id']; + $id = $result->fetchAssociative()['id']; $token = $this->mapper->getTokenById((int)$id); $this->assertEquals('user1', $token->getUID()); @@ -251,7 +251,7 @@ class PublicKeyTokenMapperTest extends TestCase { ->from('authtoken') ->where($qb->expr()->eq('token', $qb->createNamedParameter('9c5a2e661482b65597408a6bb6c4a3d1af36337381872ac56e445a06cdb7fea2b1039db707545c11027a4966919918b19d875a8b774840b18c6cbb7ae56fe206'))); $result = $qb->executeQuery(); - $name = $result->fetch()['name']; + $name = $result->fetchAssociative()['name']; $this->mapper->deleteByName($name); $this->assertEquals(4, $this->getNumberOfTokens()); } diff --git a/tests/lib/Authentication/TwoFactorAuth/Db/ProviderUserAssignmentDaoTest.php b/tests/lib/Authentication/TwoFactorAuth/Db/ProviderUserAssignmentDaoTest.php index bd52dc21821..81c01b7b28b 100644 --- a/tests/lib/Authentication/TwoFactorAuth/Db/ProviderUserAssignmentDaoTest.php +++ b/tests/lib/Authentication/TwoFactorAuth/Db/ProviderUserAssignmentDaoTest.php @@ -69,7 +69,7 @@ class ProviderUserAssignmentDaoTest extends TestCase { ->andWhere($qb->expr()->eq('uid', $qb->createNamedParameter('user123'))) ->andWhere($qb->expr()->eq('enabled', $qb->createNamedParameter(0))); $res = $q->executeQuery(); - $data = $res->fetchAll(); + $data = $res->fetchAllAssociative(); $res->closeCursor(); $this->assertCount(1, $data); } @@ -87,7 +87,7 @@ class ProviderUserAssignmentDaoTest extends TestCase { ->andWhere($qb->expr()->eq('uid', $qb->createNamedParameter('user123'))) ->andWhere($qb->expr()->eq('enabled', $qb->createNamedParameter(1))); $res = $q->executeQuery(); - $data = $res->fetchAll(); + $data = $res->fetchAllAssociative(); $res->closeCursor(); $this->assertCount(1, $data); @@ -106,7 +106,7 @@ class ProviderUserAssignmentDaoTest extends TestCase { ->andWhere($qb->expr()->eq('uid', $qb->createNamedParameter('user123'))) ->andWhere($qb->expr()->eq('enabled', $qb->createNamedParameter(1))); $res = $q->executeQuery(); - $data = $res->fetchAll(); + $data = $res->fetchAllAssociative(); $res->closeCursor(); $this->assertCount(1, $data); diff --git a/tests/lib/Calendar/ResourcesRoomsUpdaterTest.php b/tests/lib/Calendar/ResourcesRoomsUpdaterTest.php index ecad5150fb0..6d61cea0d2b 100644 --- a/tests/lib/Calendar/ResourcesRoomsUpdaterTest.php +++ b/tests/lib/Calendar/ResourcesRoomsUpdaterTest.php @@ -216,7 +216,7 @@ class ResourcesRoomsUpdaterTest extends TestCase { $rows = []; $ids = []; $stmt = $query->executeQuery(); - while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { + while ($row = $stmt->fetchAssociative()) { $ids[$row['backend_id'] . '::' . $row['resource_id']] = $row['id']; unset($row['id']); $rows[] = $row; @@ -286,7 +286,7 @@ class ResourcesRoomsUpdaterTest extends TestCase { $rows2 = []; $stmt = $query2->executeQuery(); - while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { + while ($row = $stmt->fetchAssociative()) { unset($row['id']); $rows2[] = $row; } diff --git a/tests/lib/Config/UserConfigTest.php b/tests/lib/Config/UserConfigTest.php index ca51319997f..a353f738564 100644 --- a/tests/lib/Config/UserConfigTest.php +++ b/tests/lib/Config/UserConfigTest.php @@ -190,7 +190,7 @@ class UserConfigTest extends TestCase { $sql->select('*') ->from('preferences'); $result = $sql->executeQuery(); - $this->originalPreferences = $result->fetchAll(); + $this->originalPreferences = $result->fetchAllAssociative(); $result->closeCursor(); $sql = $this->connection->getQueryBuilder(); diff --git a/tests/lib/DB/QueryBuilder/ExpressionBuilderDBTest.php b/tests/lib/DB/QueryBuilder/ExpressionBuilderDBTest.php index 112bfe2ca16..4d0cd853d8f 100644 --- a/tests/lib/DB/QueryBuilder/ExpressionBuilderDBTest.php +++ b/tests/lib/DB/QueryBuilder/ExpressionBuilderDBTest.php @@ -135,7 +135,7 @@ class ExpressionBuilderDBTest extends TestCase { ->andWhere($query->expr()->eq('configvalue', $query->createNamedParameter('myvalue', IQueryBuilder::PARAM_STR), IQueryBuilder::PARAM_STR)); $result = $query->executeQuery(); - $entries = $result->fetchAll(); + $entries = $result->fetchAllAssociative(); $result->closeCursor(); self::assertCount(1, $entries); self::assertEquals('myvalue', $entries[0]['configvalue']); @@ -153,7 +153,7 @@ class ExpressionBuilderDBTest extends TestCase { ->from('testing') ->where($query->expr()->eq('datetime', $query->createNamedParameter($dateTime, IQueryBuilder::PARAM_DATETIME_MUTABLE))) ->executeQuery(); - $entries = $result->fetchAll(); + $entries = $result->fetchAllAssociative(); $result->closeCursor(); self::assertCount(1, $entries); } @@ -171,7 +171,7 @@ class ExpressionBuilderDBTest extends TestCase { ->from('testing') ->where($query->expr()->lt('datetime', $query->createNamedParameter($dateTimeCompare, IQueryBuilder::PARAM_DATETIME_MUTABLE))) ->executeQuery(); - $entries = $result->fetchAll(); + $entries = $result->fetchAllAssociative(); $result->closeCursor(); self::assertCount(1, $entries); } @@ -189,7 +189,7 @@ class ExpressionBuilderDBTest extends TestCase { ->from('testing') ->where($query->expr()->gt('datetime', $query->createNamedParameter($dateTimeCompare, IQueryBuilder::PARAM_DATETIME_MUTABLE))) ->executeQuery(); - $entries = $result->fetchAll(); + $entries = $result->fetchAllAssociative(); $result->closeCursor(); self::assertCount(1, $entries); } diff --git a/tests/lib/DB/QueryBuilder/ExpressionBuilderTest.php b/tests/lib/DB/QueryBuilder/ExpressionBuilderTest.php index 4adf6618e81..5effc2f1469 100644 --- a/tests/lib/DB/QueryBuilder/ExpressionBuilderTest.php +++ b/tests/lib/DB/QueryBuilder/ExpressionBuilderTest.php @@ -409,7 +409,7 @@ class ExpressionBuilderTest extends TestCase { $result = $query->executeQuery(); - $this->assertEquals(['count' => $expected], $result->fetch()); + $this->assertEquals(['count' => $expected], $result->fetchAssociative()); $result->closeCursor(); $query = $this->connection->getQueryBuilder(); diff --git a/tests/lib/Files/Cache/SearchBuilderTest.php b/tests/lib/Files/Cache/SearchBuilderTest.php index 28fe6aefc77..aa936598a96 100644 --- a/tests/lib/Files/Cache/SearchBuilderTest.php +++ b/tests/lib/Files/Cache/SearchBuilderTest.php @@ -129,7 +129,7 @@ class SearchBuilderTest extends TestCase { $this->builder->andWhere($dbOperator); $result = $this->builder->executeQuery(); - $rows = $result->fetchAll(\PDO::FETCH_COLUMN); + $rows = $result->fetchFirstColumn(); $result->closeCursor(); return $rows; diff --git a/tests/lib/Files/Config/UserMountCacheTest.php b/tests/lib/Files/Config/UserMountCacheTest.php index 31a2ea36998..c0a419aaa08 100644 --- a/tests/lib/Files/Config/UserMountCacheTest.php +++ b/tests/lib/Files/Config/UserMountCacheTest.php @@ -413,7 +413,7 @@ class UserMountCacheTest extends TestCase { ->from('filecache') ->where($query->expr()->eq('storage', $query->createNamedParameter($storageId))) ->andWhere($query->expr()->eq('path_hash', $query->createNamedParameter(md5($internalPath)))); - $id = (int)$query->executeQuery()->fetchColumn(); + $id = (int)$query->executeQuery()->fetchOne(); } else { throw $e; } diff --git a/tests/lib/Files/Type/LoaderTest.php b/tests/lib/Files/Type/LoaderTest.php index a2edcd0bcf8..1c9ffb65a31 100644 --- a/tests/lib/Files/Type/LoaderTest.php +++ b/tests/lib/Files/Type/LoaderTest.php @@ -64,7 +64,7 @@ class LoaderTest extends TestCase { ->where($qb->expr()->eq('id', $qb->createPositionalParameter($mimetypeId))); $result = $qb->executeQuery(); - $mimetype = $result->fetch(); + $mimetype = $result->fetchAssociative(); $result->closeCursor(); $this->assertEquals('testing/mymimetype', $mimetype['mimetype']); diff --git a/tests/lib/Repair/OldGroupMembershipSharesTest.php b/tests/lib/Repair/OldGroupMembershipSharesTest.php index a385c1c9fc0..6eb1a63fd4e 100644 --- a/tests/lib/Repair/OldGroupMembershipSharesTest.php +++ b/tests/lib/Repair/OldGroupMembershipSharesTest.php @@ -76,7 +76,7 @@ class OldGroupMembershipSharesTest extends \Test\TestCase { ->from('share') ->orderBy('id', 'ASC') ->executeQuery(); - $rows = $result->fetchAll(); + $rows = $result->fetchAllAssociative(); $this->assertEquals([['id' => $parent], ['id' => $group2], ['id' => $user1], ['id' => $member], ['id' => $notAMember]], $rows); $result->closeCursor(); @@ -92,7 +92,7 @@ class OldGroupMembershipSharesTest extends \Test\TestCase { ->from('share') ->orderBy('id', 'ASC') ->executeQuery(); - $rows = $result->fetchAll(); + $rows = $result->fetchAllAssociative(); $this->assertEquals([['id' => $parent], ['id' => $group2], ['id' => $user1], ['id' => $member]], $rows); $result->closeCursor(); } diff --git a/tests/lib/Repair/Owncloud/UpdateLanguageCodesTest.php b/tests/lib/Repair/Owncloud/UpdateLanguageCodesTest.php index 2c735b7bc6d..7773fac7f59 100644 --- a/tests/lib/Repair/Owncloud/UpdateLanguageCodesTest.php +++ b/tests/lib/Repair/Owncloud/UpdateLanguageCodesTest.php @@ -74,7 +74,7 @@ class UpdateLanguageCodesTest extends TestCase { ->orderBy('userid') ->executeQuery(); - $rows = $result->fetchAll(); + $rows = $result->fetchAllAssociative(); $result->closeCursor(); $this->assertSame($users, $rows, 'Asserts that the entries are the ones from the test data set'); @@ -115,7 +115,7 @@ class UpdateLanguageCodesTest extends TestCase { ->orderBy('userid') ->executeQuery(); - $rows = $result->fetchAll(); + $rows = $result->fetchAllAssociative(); $result->closeCursor(); // value has changed for one user diff --git a/tests/lib/Repair/RepairInvalidSharesTest.php b/tests/lib/Repair/RepairInvalidSharesTest.php index 2171a34a6f0..3ffb1726e19 100644 --- a/tests/lib/Repair/RepairInvalidSharesTest.php +++ b/tests/lib/Repair/RepairInvalidSharesTest.php @@ -104,7 +104,7 @@ class RepairInvalidSharesTest extends TestCase { ->from('share') ->orderBy('id', 'ASC') ->executeQuery(); - $rows = $result->fetchAll(); + $rows = $result->fetchAllAssociative(); $this->assertEquals([['id' => $parent], ['id' => $validChild], ['id' => $invalidChild]], $rows); $result->closeCursor(); @@ -120,7 +120,7 @@ class RepairInvalidSharesTest extends TestCase { ->from('share') ->orderBy('id', 'ASC') ->executeQuery(); - $rows = $result->fetchAll(); + $rows = $result->fetchAllAssociative(); $this->assertEquals([['id' => $parent], ['id' => $validChild]], $rows); $result->closeCursor(); } @@ -180,7 +180,7 @@ class RepairInvalidSharesTest extends TestCase { ->from('share') ->orderBy('permissions', 'ASC') ->executeQuery() - ->fetchAll(); + ->fetchAllAssociative(); $this->assertCount(1, $results); diff --git a/tests/lib/Share20/DefaultShareProviderTest.php b/tests/lib/Share20/DefaultShareProviderTest.php index d79dbbada3d..2ceb77aeb50 100644 --- a/tests/lib/Share20/DefaultShareProviderTest.php +++ b/tests/lib/Share20/DefaultShareProviderTest.php @@ -494,7 +494,7 @@ class DefaultShareProviderTest extends \Test\TestCase { ->from('share'); $cursor = $qb->executeQuery(); - $result = $cursor->fetchAll(); + $result = $cursor->fetchAllAssociative(); $cursor->closeCursor(); $this->assertEmpty($result); @@ -527,7 +527,7 @@ class DefaultShareProviderTest extends \Test\TestCase { ->from('share'); $cursor = $qb->executeQuery(); - $result = $cursor->fetchAll(); + $result = $cursor->fetchAllAssociative(); $cursor->closeCursor(); $this->assertEmpty($result); @@ -592,7 +592,7 @@ class DefaultShareProviderTest extends \Test\TestCase { ->from('share'); $cursor = $qb->executeQuery(); - $result = $cursor->fetchAll(); + $result = $cursor->fetchAllAssociative(); $cursor->closeCursor(); $this->assertEmpty($result); @@ -1553,7 +1553,7 @@ class DefaultShareProviderTest extends \Test\TestCase { ->where($qb->expr()->eq('share_type', $qb->createNamedParameter(2))) ->executeQuery(); - $shares = $stmt->fetchAll(); + $shares = $stmt->fetchAllAssociative(); $stmt->closeCursor(); $this->assertCount(1, $shares); @@ -1625,7 +1625,7 @@ class DefaultShareProviderTest extends \Test\TestCase { ->where($qb->expr()->eq('share_type', $qb->createNamedParameter(2))) ->executeQuery(); - $shares = $stmt->fetchAll(); + $shares = $stmt->fetchAllAssociative(); $stmt->closeCursor(); $this->assertCount(1, $shares); @@ -1763,7 +1763,7 @@ class DefaultShareProviderTest extends \Test\TestCase { ->where($qb->expr()->eq('id', $qb->createNamedParameter($id))) ->executeQuery(); - $shares = $stmt->fetchAll(); + $shares = $stmt->fetchAllAssociative(); $stmt->closeCursor(); $this->assertCount(0, $shares); @@ -2188,7 +2188,7 @@ class DefaultShareProviderTest extends \Test\TestCase { ->orderBy('id') ->executeQuery(); - $shares = $stmt->fetchAll(); + $shares = $stmt->fetchAllAssociative(); $this->assertSame('user0', $shares[0]['share_with']); $this->assertSame('user4', $shares[0]['uid_initiator']); @@ -2329,7 +2329,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $qb->expr()->eq('id', $qb->createNamedParameter($id)) ); $cursor = $qb->executeQuery(); - $data = $cursor->fetchAll(); + $data = $cursor->fetchAllAssociative(); $cursor->closeCursor(); $this->assertCount($rowDeleted ? 0 : 1, $data); @@ -2388,7 +2388,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $qb->expr()->eq('id', $qb->createNamedParameter($userGroupId)) ); $cursor = $qb->executeQuery(); - $data = $cursor->fetchAll(); + $data = $cursor->fetchAllAssociative(); $cursor->closeCursor(); $this->assertCount($userGroupShareDeleted ? 0 : 1, $data); @@ -2399,7 +2399,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $qb->expr()->eq('id', $qb->createNamedParameter($groupId)) ); $cursor = $qb->executeQuery(); - $data = $cursor->fetchAll(); + $data = $cursor->fetchAllAssociative(); $cursor->closeCursor(); $this->assertCount($groupShareDeleted ? 0 : 1, $data); } @@ -2492,7 +2492,7 @@ class DefaultShareProviderTest extends \Test\TestCase { ->from('share') ->where($qb->expr()->in('id', $qb->createNamedParameter($ids, IQueryBuilder::PARAM_INT_ARRAY))) ->executeQuery(); - $data = $cursor->fetchAll(); + $data = $cursor->fetchAllAssociative(); $cursor->closeCursor(); $this->assertCount($shouldBeDeleted ? 0 : count($ids), $data); @@ -2550,7 +2550,7 @@ class DefaultShareProviderTest extends \Test\TestCase { ->from('share') ->where($qb->expr()->eq('id', $qb->createNamedParameter($id2))); $cursor = $qb->executeQuery(); - $data = $cursor->fetchAll(); + $data = $cursor->fetchAllAssociative(); $cursor->closeCursor(); $this->assertCount($toDelete ? 0 : 1, $data); diff --git a/tests/lib/SubAdminTest.php b/tests/lib/SubAdminTest.php index 4c0b1c33434..1446cab040d 100644 --- a/tests/lib/SubAdminTest.php +++ b/tests/lib/SubAdminTest.php @@ -111,7 +111,7 @@ class SubAdminTest extends \Test\TestCase { ->where($qb->expr()->eq('gid', $qb->createNamedParameter($this->groups[0]->getGID()))) ->andWHere($qb->expr()->eq('uid', $qb->createNamedParameter($this->users[0]->getUID()))) ->executeQuery() - ->fetch(); + ->fetchAssociative(); $this->assertEquals( [ 'gid' => $this->groups[0]->getGID(), @@ -137,7 +137,7 @@ class SubAdminTest extends \Test\TestCase { ->where($qb->expr()->eq('gid', $qb->createNamedParameter($this->groups[0]->getGID()))) ->andWHere($qb->expr()->eq('uid', $qb->createNamedParameter($this->users[0]->getUID()))) ->executeQuery() - ->fetch(); + ->fetchAssociative(); $this->assertEmpty($result); }