diff options
author | Jörn Friedrich Dreyer <jfd@butonic.de> | 2016-08-22 13:35:51 +0200 |
---|---|---|
committer | Lukas Reschke <lukas@statuscode.ch> | 2016-08-29 14:20:51 +0200 |
commit | d5518735c9bca7415e6966a87def0b88080947df (patch) | |
tree | 2349afa36598b1bed6675ab5a9ffa8c95f79742c /lib/private/Files/Cache/Storage.php | |
parent | 3647fbe7cd86e743b059889d69b03fcf8207780f (diff) | |
download | nextcloud-server-d5518735c9bca7415e6966a87def0b88080947df.tar.gz nextcloud-server-d5518735c9bca7415e6966a87def0b88080947df.zip |
always return numeric storage id as int, also check type equality in test asserts
Diffstat (limited to 'lib/private/Files/Cache/Storage.php')
-rw-r--r-- | lib/private/Files/Cache/Storage.php | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/private/Files/Cache/Storage.php b/lib/private/Files/Cache/Storage.php index 99b127ab220..8a076084ac5 100644 --- a/lib/private/Files/Cache/Storage.php +++ b/lib/private/Files/Cache/Storage.php @@ -57,15 +57,15 @@ class Storage { $this->storageId = self::adjustStorageId($this->storageId); if ($row = self::getStorageById($this->storageId)) { - $this->numericId = $row['numeric_id']; + $this->numericId = (int)$row['numeric_id']; } else { $connection = \OC::$server->getDatabaseConnection(); $available = $isAvailable ? 1 : 0; if ($connection->insertIfNotExist('*PREFIX*storages', ['id' => $this->storageId, 'available' => $available])) { - $this->numericId = $connection->lastInsertId('*PREFIX*storages'); + $this->numericId = (int)$connection->lastInsertId('*PREFIX*storages'); } else { if ($row = self::getStorageById($this->storageId)) { - $this->numericId = $row['numeric_id']; + $this->numericId = (int)$row['numeric_id']; } else { throw new \RuntimeException('Storage could neither be inserted nor be selected from the database'); } @@ -132,7 +132,7 @@ class Storage { $storageId = self::adjustStorageId($storageId); if ($row = self::getStorageById($storageId)) { - return $row['numeric_id']; + return (int)$row['numeric_id']; } else { return null; } |