Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fix similar potential problems with fetchOne loops
Signed-off-by: Côme Chilliet <[email protected]>
  • Loading branch information
come-nc authored and backportbot[bot] committed Mar 10, 2022
commit a737a2561bb9ef7a71e9633bb6abacb7b0beaedb
6 changes: 3 additions & 3 deletions apps/user_ldap/lib/Mapping/AbstractMapping.php
Original file line number Diff line number Diff line change
Expand Up @@ -438,14 +438,14 @@ public function clearCb(callable $preCallback, callable $postCallback): bool {
$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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ protected function getNextcloudIdsByUuid(string $table, string $uuid): array {

$result = $select->executeQuery();
$idList = [];
while ($id = $result->fetchOne()) {
while (($id = $result->fetchOne()) !== false) {
$idList[] = $id;
}
$result->closeCursor();
Expand Down
2 changes: 1 addition & 1 deletion apps/workflowengine/lib/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ protected function canModify(int $id, ScopeContext $scopeContext):bool {
$result = $qb->execute();

$this->operationsByScope[$scopeContext->getHash()] = [];
while ($opId = $result->fetchOne()) {
while (($opId = $result->fetchOne()) !== false) {
$this->operationsByScope[$scopeContext->getHash()][] = (int)$opId;
}
$result->closeCursor();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ protected function populateScopeTable(IResult $ids): void {
$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();
}
Expand Down