Skip to content

Commit 017c17a

Browse files
committed
fix: false renames of fetch()
1 parent 65861e8 commit 017c17a

8 files changed

Lines changed: 19 additions & 17 deletions

File tree

apps/files_external/tests/Command/CommandTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,6 @@ protected function getInput(Command $command, array $arguments = [], array $opti
100100
protected function executeCommand(Command $command, Input $input) {
101101
$output = new BufferedOutput();
102102
self::invokePrivate($command, 'execute', [$input, $output]);
103-
return $output->fetchAssociative();
103+
return $output->fetch();
104104
}
105105
}

apps/files_external/tests/Command/ConfigCommandTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public function testSetConfigValue($value) {
8585

8686
$output = new BufferedOutput();
8787
$result = self::invokePrivate($command, 'getOption', [$mount, 'filesystem_check_changes', $output]);
88-
$this->assertEquals($value, \trim($output->fetchAssociative()));
88+
$this->assertEquals($value, \trim($output->fetch()));
8989
}
9090

9191
public function optionsProvider() {

apps/files_external/tests/Command/ListCommandTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public function testListAuthIdentifier() {
6767
$output = new BufferedOutput();
6868

6969
$instance->listMounts('', [$mount1, $mount2], $input, $output);
70-
$output = \json_decode($output->fetchAssociative(), true);
70+
$output = \json_decode($output->fetch(), true);
7171

7272
$this->assertNotEquals($output[0]['authentication_type'], $output[1]['authentication_type']);
7373
}
@@ -88,7 +88,7 @@ public function testDisplayWarningForIncomplete() {
8888
$output = new BufferedOutput();
8989

9090
$instance->listMounts('', [$mount1, $mount2], $input, $output);
91-
$output = $output->fetchAssociative();
91+
$output = $output->fetch();
9292

9393
$this->assertMatchesRegularExpression('/Number of invalid storages found/', $output);
9494
}
@@ -154,7 +154,7 @@ public function testShortView($options, $expectedResult, $mountOptions) {
154154
$output = new BufferedOutput();
155155

156156
$instance->listMounts('user1', [$mount1, $mount2], $input, $output);
157-
$output = $output->fetchAssociative();
157+
$output = $output->fetch();
158158
if (isset($options['output']) && ($options['output'] === 'json')) {
159159
$results = \json_decode($output, true);
160160
$countResults = \count($results);
@@ -229,7 +229,7 @@ public function testLongView($options, $expectedResult, $mountOptions) {
229229
$output = new BufferedOutput();
230230

231231
$instance->listMounts('user1', [$mount1, $mount2], $input, $output);
232-
$output = $output->fetchAssociative();
232+
$output = $output->fetch();
233233
if (isset($options['output']) && ($options['output'] === 'json')) {
234234
$results = \json_decode($output, true);
235235
$countResults = \count($results);
@@ -302,7 +302,7 @@ public function testImportableFormat($options, $expectedResult, $mountOptions) {
302302
$output = new BufferedOutput();
303303

304304
$instance->listMounts('user1', [$mount1, $mount2], $input, $output);
305-
$output = $output->fetchAssociative();
305+
$output = $output->fetch();
306306
if (isset($options['output']) && ($options['output'] === 'json')) {
307307
$results = \json_decode($output, true);
308308
$countResults = \count($results);

lib/private/Comments/Manager.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,9 @@ protected function updateChildrenInformation($id, \DateTime $cDateTime) {
162162
->setParameter('id', $id);
163163

164164
$resultStatement = $query->execute();
165-
$data = $resultStatement->fetch(\PDO::FETCH_NUM);
165+
$data = $resultStatement->fetchNumeric();
166166
$resultStatement->free();
167-
$children = \intval($data[0]);
167+
$children = (int)$data[0];
168168

169169
$comment = $this->get($id);
170170
$comment->setChildrenCount($children);
@@ -443,9 +443,9 @@ public function getNumberOfCommentsForObject($objectType, $objectId, \DateTime $
443443
}
444444

445445
$resultStatement = $query->execute();
446-
$data = $resultStatement->fetch(\PDO::FETCH_NUM);
446+
$data = $resultStatement->fetchNumeric();
447447
$resultStatement->free();
448-
return \intval($data[0]);
448+
return (int)$data[0];
449449
}
450450

451451
/**

lib/private/DB/Connection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ public function prepare($statement, $limit=null, $offset=null) : \Doctrine\DBAL\
182182
* @param array $types The types the previous parameters are in.
183183
* @param \Doctrine\DBAL\Cache\QueryCacheProfile|null $qcp The query cache profile, optional.
184184
*
185-
* @return \Doctrine\DBAL\Driver\Statement The executed statement.
185+
* @return Result The executed statement.
186186
*
187187
* @throws \Doctrine\DBAL\Exception
188188
*/

lib/private/SystemTag/SystemTagObjectMapper.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -237,14 +237,14 @@ public function haveTag($objIds, $objectType, $tagId, $all = true) {
237237
->setParameter('objecttype', $objectType);
238238

239239
$result = $query->execute();
240-
$row = $result->fetch(\PDO::FETCH_NUM);
240+
$row = $result->fetchNumeric();
241241
$result->free();
242242

243243
if ($all) {
244244
return ((int)$row[0] === \count($objIds));
245-
} else {
246-
return (bool) $row;
247245
}
246+
247+
return (bool) $row;
248248
}
249249

250250
/**

lib/private/legacy/util.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -967,7 +967,8 @@ public static function checkDatabaseVersion() {
967967
// check PostgreSQL version
968968
try {
969969
$result = \OC::$server->getDatabaseConnection()->executeQuery('SHOW SERVER_VERSION');
970-
$data = $result->fetch();
970+
$data = $result->fetchAssociative();
971+
$result->free();
971972
if (isset($data['server_version'])) {
972973
$version = $data['server_version'];
973974
if (\version_compare($version, '9.0.0', '<')) {

tests/lib/Repair/RepairMimeTypesTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@ private function getMimeTypeIdFromDB($mimeType) {
9696
$sql = 'SELECT `id` FROM `*PREFIX*mimetypes` WHERE `mimetype` = ?';
9797
$connection = \OC::$server->getDatabaseConnection();
9898
$results = $connection->executeQuery($sql, [$mimeType]);
99-
$result = $results->fetch();
99+
$result = $results->fetchAssociative();
100+
$results->free();
100101
if ($result) {
101102
return $result['id'];
102103
}

0 commit comments

Comments
 (0)