From 65a866556bf871f98ab6486dd104e758c06f039b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Chilliet?= Date: Tue, 8 Mar 2022 11:45:18 +0100 Subject: Fix duplicated UUID detection when there are empty uuids MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Côme Chilliet --- apps/user_ldap/lib/Migration/Version1130Date20211102154716.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'apps') diff --git a/apps/user_ldap/lib/Migration/Version1130Date20211102154716.php b/apps/user_ldap/lib/Migration/Version1130Date20211102154716.php index 2cca72ac493..c92c4c794ae 100644 --- a/apps/user_ldap/lib/Migration/Version1130Date20211102154716.php +++ b/apps/user_ldap/lib/Migration/Version1130Date20211102154716.php @@ -278,7 +278,7 @@ class Version1130Date20211102154716 extends SimpleMigrationStep { ->having($select->expr()->gt($select->func()->count('owncloud_name'), $select->createNamedParameter(1))); $result = $select->executeQuery(); - while ($uuid = $result->fetchOne()) { + while (($uuid = $result->fetchOne()) !== false) { yield $uuid; } $result->closeCursor(); -- cgit v1.2.3 From ccab35f23f3b102b11f93e1d5e7e2f4fadadb56f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Chilliet?= Date: Tue, 8 Mar 2022 12:10:52 +0100 Subject: Fix similar potential problems with fetchOne loops MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Côme Chilliet --- apps/user_ldap/lib/Mapping/AbstractMapping.php | 6 +++--- apps/user_ldap/lib/Migration/Version1130Date20211102154716.php | 2 +- apps/workflowengine/lib/Manager.php | 2 +- .../lib/Migration/PopulateNewlyIntroducedDatabaseFields.php | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) (limited to 'apps') diff --git a/apps/user_ldap/lib/Mapping/AbstractMapping.php b/apps/user_ldap/lib/Mapping/AbstractMapping.php index 16973f76ff4..1a747cc8bfd 100644 --- a/apps/user_ldap/lib/Mapping/AbstractMapping.php +++ b/apps/user_ldap/lib/Mapping/AbstractMapping.php @@ -438,14 +438,14 @@ abstract class AbstractMapping { $picker = $this->dbc->getQueryBuilder(); $picker->select('owncloud_name') ->from($this->getTableName()); - $cursor = $picker->execute(); + $cursor = $picker->executeQuery(); $result = true; - while ($id = $cursor->fetchOne()) { + while (($id = $cursor->fetchOne()) !== false) { $preCallback($id); if ($isUnmapped = $this->unmap($id)) { $postCallback($id); } - $result &= $isUnmapped; + $result = $result && $isUnmapped; } $cursor->closeCursor(); return $result; diff --git a/apps/user_ldap/lib/Migration/Version1130Date20211102154716.php b/apps/user_ldap/lib/Migration/Version1130Date20211102154716.php index c92c4c794ae..3f590df7fa5 100644 --- a/apps/user_ldap/lib/Migration/Version1130Date20211102154716.php +++ b/apps/user_ldap/lib/Migration/Version1130Date20211102154716.php @@ -259,7 +259,7 @@ class Version1130Date20211102154716 extends SimpleMigrationStep { $result = $select->executeQuery(); $idList = []; - while ($id = $result->fetchOne()) { + while (($id = $result->fetchOne()) !== false) { $idList[] = $id; } $result->closeCursor(); diff --git a/apps/workflowengine/lib/Manager.php b/apps/workflowengine/lib/Manager.php index 178bc87365b..34dbf507b91 100644 --- a/apps/workflowengine/lib/Manager.php +++ b/apps/workflowengine/lib/Manager.php @@ -351,7 +351,7 @@ class Manager implements IManager { $result = $qb->execute(); $this->operationsByScope[$scopeContext->getHash()] = []; - while ($opId = $result->fetchOne()) { + while (($opId = $result->fetchOne()) !== false) { $this->operationsByScope[$scopeContext->getHash()][] = (int)$opId; } $result->closeCursor(); diff --git a/apps/workflowengine/lib/Migration/PopulateNewlyIntroducedDatabaseFields.php b/apps/workflowengine/lib/Migration/PopulateNewlyIntroducedDatabaseFields.php index 019d3ae6bcc..974793e99b2 100644 --- a/apps/workflowengine/lib/Migration/PopulateNewlyIntroducedDatabaseFields.php +++ b/apps/workflowengine/lib/Migration/PopulateNewlyIntroducedDatabaseFields.php @@ -57,7 +57,7 @@ class PopulateNewlyIntroducedDatabaseFields implements IRepairStep { $qb = $this->dbc->getQueryBuilder(); $insertQuery = $qb->insert('flow_operations_scope'); - while ($id = $ids->fetchOne()) { + while (($id = $ids->fetchOne()) !== false) { $insertQuery->values(['operation_id' => $qb->createNamedParameter($id), 'type' => IManager::SCOPE_ADMIN]); $insertQuery->execute(); } -- cgit v1.2.3