summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/private/BackgroundJob/JobList.php1
-rw-r--r--lib/private/Comments/Manager.php1
-rw-r--r--lib/private/DB/Connection.php1
-rw-r--r--lib/private/Diagnostics/QueryLogger.php2
-rw-r--r--lib/private/Files/Cache/Cache.php1
-rw-r--r--lib/private/Files/Cache/Propagator.php2
-rw-r--r--lib/private/Files/Config/UserMountCache.php5
-rw-r--r--lib/private/Files/FileInfo.php2
-rw-r--r--lib/private/Files/Filesystem.php8
-rw-r--r--lib/private/Files/View.php11
-rw-r--r--lib/private/Hooks/LegacyEmitter.php7
-rw-r--r--lib/private/Hooks/PublicEmitter.php2
-rw-r--r--lib/private/Lock/DBLockingProvider.php1
-rw-r--r--lib/private/Repair/CleanTags.php1
-rw-r--r--lib/private/Repair/NC13/RepairInvalidPaths.php11
-rw-r--r--lib/private/Repair/OldGroupMembershipShares.php1
-rw-r--r--lib/private/Repair/RepairInvalidShares.php1
-rw-r--r--lib/private/Security/Bruteforce/Throttler.php1
-rw-r--r--lib/private/Settings/Mapper.php1
-rw-r--r--lib/private/Setup/PostgreSQL.php5
-rw-r--r--lib/private/Share/Share.php3
-rw-r--r--lib/private/Share20/Manager.php10
-rw-r--r--lib/private/Share20/ProviderFactory.php2
-rw-r--r--lib/private/Template/JSCombiner.php15
-rw-r--r--lib/private/TemplateLayout.php3
-rw-r--r--lib/private/User/Manager.php3
26 files changed, 70 insertions, 31 deletions
diff --git a/lib/private/BackgroundJob/JobList.php b/lib/private/BackgroundJob/JobList.php
index b0c580290ed..366fe8aac03 100644
--- a/lib/private/BackgroundJob/JobList.php
+++ b/lib/private/BackgroundJob/JobList.php
@@ -284,6 +284,7 @@ class JobList implements IJobList {
* Remove the reservation for a job
*
* @param IJob $job
+ * @suppress SqlInjectionChecker
*/
public function unlockJob(IJob $job) {
$query = $this->connection->getQueryBuilder();
diff --git a/lib/private/Comments/Manager.php b/lib/private/Comments/Manager.php
index f1c5b7dca50..4645adc6c5b 100644
--- a/lib/private/Comments/Manager.php
+++ b/lib/private/Comments/Manager.php
@@ -691,6 +691,7 @@ class Manager implements ICommentsManager {
* @param \DateTime $dateTime
* @param IUser $user
* @since 9.0.0
+ * @suppress SqlInjectionChecker
*/
public function setReadMark($objectType, $objectId, \DateTime $dateTime, IUser $user) {
$this->checkRoleParameters('Object', $objectType, $objectId);
diff --git a/lib/private/DB/Connection.php b/lib/private/DB/Connection.php
index 563c077b04a..4f042e403f1 100644
--- a/lib/private/DB/Connection.php
+++ b/lib/private/DB/Connection.php
@@ -272,6 +272,7 @@ class Connection extends \Doctrine\DBAL\Connection implements IDBConnection {
* @return int number of new rows
* @throws \Doctrine\DBAL\DBALException
* @throws PreConditionNotMetException
+ * @suppress SqlInjectionChecker
*/
public function setValues($table, array $keys, array $values, array $updatePreconditionValues = []) {
try {
diff --git a/lib/private/Diagnostics/QueryLogger.php b/lib/private/Diagnostics/QueryLogger.php
index 875d25e9be3..2b007b4f044 100644
--- a/lib/private/Diagnostics/QueryLogger.php
+++ b/lib/private/Diagnostics/QueryLogger.php
@@ -35,7 +35,7 @@ class QueryLogger implements IQueryLogger {
protected $activeQuery;
/**
- * @var \OC\Diagnostics\Query[]
+ * @var CappedMemoryCache
*/
protected $queries;
diff --git a/lib/private/Files/Cache/Cache.php b/lib/private/Files/Cache/Cache.php
index 1f3f2433e45..b2f379fe2c2 100644
--- a/lib/private/Files/Cache/Cache.php
+++ b/lib/private/Files/Cache/Cache.php
@@ -502,6 +502,7 @@ class Cache implements ICache {
* @param string $targetPath
* @throws \OC\DatabaseException
* @throws \Exception if the given storages have an invalid id
+ * @suppress SqlInjectionChecker
*/
public function moveFromCache(ICache $sourceCache, $sourcePath, $targetPath) {
if ($sourceCache instanceof Cache) {
diff --git a/lib/private/Files/Cache/Propagator.php b/lib/private/Files/Cache/Propagator.php
index d597a479f54..be69d174a0d 100644
--- a/lib/private/Files/Cache/Propagator.php
+++ b/lib/private/Files/Cache/Propagator.php
@@ -58,6 +58,7 @@ class Propagator implements IPropagator {
* @param string $internalPath
* @param int $time
* @param int $sizeDifference number of bytes the file has grown
+ * @suppress SqlInjectionChecker
*/
public function propagateChange($internalPath, $time, $sizeDifference = 0) {
$storageId = (int)$this->storage->getStorageCache()->getNumericId();
@@ -140,6 +141,7 @@ class Propagator implements IPropagator {
/**
* Commit the active propagation batch
+ * @suppress SqlInjectionChecker
*/
public function commitBatch() {
if (!$this->inBatch) {
diff --git a/lib/private/Files/Config/UserMountCache.php b/lib/private/Files/Config/UserMountCache.php
index 80cedfa1ccd..7ecad6e8cfb 100644
--- a/lib/private/Files/Config/UserMountCache.php
+++ b/lib/private/Files/Config/UserMountCache.php
@@ -334,6 +334,11 @@ class UserMountCache implements IUserMountCache {
$query->execute();
}
+ /**
+ * @param array $users
+ * @return array
+ * @suppress SqlInjectionChecker
+ */
public function getUsedSpaceForUsers(array $users) {
$builder = $this->connection->getQueryBuilder();
diff --git a/lib/private/Files/FileInfo.php b/lib/private/Files/FileInfo.php
index e1b5bf983ce..f5a44ba02ea 100644
--- a/lib/private/Files/FileInfo.php
+++ b/lib/private/Files/FileInfo.php
@@ -193,7 +193,7 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess {
*/
public function getSize() {
$this->updateEntryfromSubMounts();
- return isset($this->data['size']) ? (int) $this->data['size'] : 0;
+ return isset($this->data['size']) ? 0 + $this->data['size'] : 0;
}
/**
diff --git a/lib/private/Files/Filesystem.php b/lib/private/Files/Filesystem.php
index 0ebf23818b4..caf23afba11 100644
--- a/lib/private/Files/Filesystem.php
+++ b/lib/private/Files/Filesystem.php
@@ -646,14 +646,6 @@ class Filesystem {
return self::$defaultInstance->rmdir($path);
}
- static public function opendir($path) {
- return self::$defaultInstance->opendir($path);
- }
-
- static public function readdir($path) {
- return self::$defaultInstance->readdir($path);
- }
-
static public function is_dir($path) {
return self::$defaultInstance->is_dir($path);
}
diff --git a/lib/private/Files/View.php b/lib/private/Files/View.php
index 0e22415e6f7..c384d07c037 100644
--- a/lib/private/Files/View.php
+++ b/lib/private/Files/View.php
@@ -367,15 +367,6 @@ class View {
}
/**
- * @param $handle
- * @return mixed
- */
- public function readdir($handle) {
- $fsLocal = new Storage\Local(array('datadir' => '/'));
- return $fsLocal->readdir($handle);
- }
-
- /**
* @param string $path
* @return bool|mixed
*/
@@ -1292,7 +1283,7 @@ class View {
* @param \OC\Files\Storage\Storage $storage
* @param string $internalPath
* @param string $relativePath
- * @return array|bool
+ * @return ICacheEntry|bool
*/
private function getCacheEntry($storage, $internalPath, $relativePath) {
$cache = $storage->getCache($internalPath);
diff --git a/lib/private/Hooks/LegacyEmitter.php b/lib/private/Hooks/LegacyEmitter.php
index 4f936e8aab5..d18bb88eae6 100644
--- a/lib/private/Hooks/LegacyEmitter.php
+++ b/lib/private/Hooks/LegacyEmitter.php
@@ -24,6 +24,13 @@
namespace OC\Hooks;
abstract class LegacyEmitter extends BasicEmitter {
+ /**
+ * @param string $scope
+ * @param string $method
+ * @param array $arguments
+ *
+ * @suppress PhanAccessMethodProtected
+ */
protected function emit($scope, $method, array $arguments = array()) {
\OC_Hook::emit($scope, $method, $arguments);
parent::emit($scope, $method, $arguments);
diff --git a/lib/private/Hooks/PublicEmitter.php b/lib/private/Hooks/PublicEmitter.php
index 4bdaeec3b49..b34769d9b09 100644
--- a/lib/private/Hooks/PublicEmitter.php
+++ b/lib/private/Hooks/PublicEmitter.php
@@ -28,6 +28,8 @@ class PublicEmitter extends BasicEmitter {
* @param string $scope
* @param string $method
* @param array $arguments optional
+ *
+ * @suppress PhanAccessMethodProtected
*/
public function emit($scope, $method, array $arguments = array()) {
parent::emit($scope, $method, $arguments);
diff --git a/lib/private/Lock/DBLockingProvider.php b/lib/private/Lock/DBLockingProvider.php
index c521bcf548b..f4778a35fa8 100644
--- a/lib/private/Lock/DBLockingProvider.php
+++ b/lib/private/Lock/DBLockingProvider.php
@@ -255,6 +255,7 @@ class DBLockingProvider extends AbstractLockingProvider {
/**
* release all lock acquired by this instance which were marked using the mark* methods
+ * @suppress SqlInjectionChecker
*/
public function releaseAll() {
parent::releaseAll();
diff --git a/lib/private/Repair/CleanTags.php b/lib/private/Repair/CleanTags.php
index 9b44fb1e671..d3bea0f9957 100644
--- a/lib/private/Repair/CleanTags.php
+++ b/lib/private/Repair/CleanTags.php
@@ -167,6 +167,7 @@ class CleanTags implements IRepairStep {
* @param string $sourceId
* @param string $sourceNullColumn If this column is null in the source table,
* the entry is deleted in the $deleteTable
+ * @suppress SqlInjectionChecker
*/
protected function deleteOrphanEntries(IOutput $output, $repairInfo, $deleteTable, $deleteId, $sourceTable, $sourceId, $sourceNullColumn) {
$qb = $this->connection->getQueryBuilder();
diff --git a/lib/private/Repair/NC13/RepairInvalidPaths.php b/lib/private/Repair/NC13/RepairInvalidPaths.php
index cf0b9e7783e..cbbbc82801c 100644
--- a/lib/private/Repair/NC13/RepairInvalidPaths.php
+++ b/lib/private/Repair/NC13/RepairInvalidPaths.php
@@ -51,6 +51,10 @@ class RepairInvalidPaths implements IRepairStep {
return 'Repair invalid paths in file cache';
}
+ /**
+ * @return \Generator
+ * @suppress SqlInjectionChecker
+ */
private function getInvalidEntries() {
$builder = $this->connection->getQueryBuilder();
@@ -76,7 +80,7 @@ class RepairInvalidPaths implements IRepairStep {
yield $row;
}
$result->closeCursor();
- } while (count($rows) >= self::MAX_ROWS);
+ } while (count($rows) > 0);
}
private function getId($storage, $path) {
@@ -95,6 +99,11 @@ class RepairInvalidPaths implements IRepairStep {
return $this->getIdQuery->execute()->fetchColumn();
}
+ /**
+ * @param string $fileid
+ * @param string $newPath
+ * @suppress SqlInjectionChecker
+ */
private function update($fileid, $newPath) {
if (!$this->updateQuery) {
$builder = $this->connection->getQueryBuilder();
diff --git a/lib/private/Repair/OldGroupMembershipShares.php b/lib/private/Repair/OldGroupMembershipShares.php
index ea0256f64b8..5b941d1fcbd 100644
--- a/lib/private/Repair/OldGroupMembershipShares.php
+++ b/lib/private/Repair/OldGroupMembershipShares.php
@@ -65,6 +65,7 @@ class OldGroupMembershipShares implements IRepairStep {
* Must throw exception on error.
*
* @throws \Exception in case of failure
+ * @suppress SqlInjectionChecker
*/
public function run(IOutput $output) {
$deletedEntries = 0;
diff --git a/lib/private/Repair/RepairInvalidShares.php b/lib/private/Repair/RepairInvalidShares.php
index 78884ca9cde..92423165541 100644
--- a/lib/private/Repair/RepairInvalidShares.php
+++ b/lib/private/Repair/RepairInvalidShares.php
@@ -56,6 +56,7 @@ class RepairInvalidShares implements IRepairStep {
/**
* Adjust file share permissions
+ * @suppress SqlInjectionChecker
*/
private function adjustFileSharePermissions(IOutput $out) {
$mask = \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_SHARE;
diff --git a/lib/private/Security/Bruteforce/Throttler.php b/lib/private/Security/Bruteforce/Throttler.php
index ee02bc5a1c4..f495baf1924 100644
--- a/lib/private/Security/Bruteforce/Throttler.php
+++ b/lib/private/Security/Bruteforce/Throttler.php
@@ -89,6 +89,7 @@ class Throttler {
* @param string $action
* @param string $ip
* @param array $metadata Optional metadata logged to the database
+ * @suppress SqlInjectionChecker
*/
public function registerAttempt($action,
$ip,
diff --git a/lib/private/Settings/Mapper.php b/lib/private/Settings/Mapper.php
index 3219a812cd5..ceb68c9eebf 100644
--- a/lib/private/Settings/Mapper.php
+++ b/lib/private/Settings/Mapper.php
@@ -198,6 +198,7 @@ class Mapper {
* @param string $idCol
* @param string $id
* @param array $values
+ * @suppress SqlInjectionChecker
*/
public function update($table, $idCol, $id, $values) {
$query = $this->dbc->getQueryBuilder();
diff --git a/lib/private/Setup/PostgreSQL.php b/lib/private/Setup/PostgreSQL.php
index 18ed9fcdef6..8267b065142 100644
--- a/lib/private/Setup/PostgreSQL.php
+++ b/lib/private/Setup/PostgreSQL.php
@@ -34,6 +34,11 @@ use OCP\IDBConnection;
class PostgreSQL extends AbstractDatabase {
public $dbprettyname = 'PostgreSQL';
+ /**
+ * @param string $username
+ * @throws \OC\DatabaseSetupException
+ * @suppress SqlInjectionChecker
+ */
public function setupDatabase($username) {
try {
$connection = $this->connect([
diff --git a/lib/private/Share/Share.php b/lib/private/Share/Share.php
index dc96d856ba6..8938c6f3066 100644
--- a/lib/private/Share/Share.php
+++ b/lib/private/Share/Share.php
@@ -913,8 +913,7 @@ class Share extends Constants {
$token = $oldToken;
} else {
$token = \OC::$server->getSecureRandom()->generate(self::TOKEN_LENGTH,
- \OCP\Security\ISecureRandom::CHAR_LOWER.\OCP\Security\ISecureRandom::CHAR_UPPER.
- \OCP\Security\ISecureRandom::CHAR_DIGITS
+ \OCP\Security\ISecureRandom::CHAR_HUMAN_READABLE
);
}
$result = self::put($itemType, $itemSource, $shareType, $shareWith, $uidOwner, $permissions,
diff --git a/lib/private/Share20/Manager.php b/lib/private/Share20/Manager.php
index b90cc12fc85..ca9d8e2843f 100644
--- a/lib/private/Share20/Manager.php
+++ b/lib/private/Share20/Manager.php
@@ -168,6 +168,8 @@ class Manager implements IManager {
* @param \OCP\Share\IShare $share
* @throws \InvalidArgumentException
* @throws GenericShareException
+ *
+ * @suppress PhanUndeclaredClassMethod
*/
protected function generalCreateChecks(\OCP\Share\IShare $share) {
if ($share->getShareType() === \OCP\Share::SHARE_TYPE_USER) {
@@ -581,9 +583,7 @@ class Manager implements IManager {
$share->setToken(
$this->secureRandom->generate(
\OC\Share\Constants::TOKEN_LENGTH,
- \OCP\Security\ISecureRandom::CHAR_LOWER.
- \OCP\Security\ISecureRandom::CHAR_UPPER.
- \OCP\Security\ISecureRandom::CHAR_DIGITS
+ \OCP\Security\ISecureRandom::CHAR_HUMAN_READABLE
)
);
@@ -601,9 +601,7 @@ class Manager implements IManager {
$share->setToken(
$this->secureRandom->generate(
\OC\Share\Constants::TOKEN_LENGTH,
- \OCP\Security\ISecureRandom::CHAR_LOWER.
- \OCP\Security\ISecureRandom::CHAR_UPPER.
- \OCP\Security\ISecureRandom::CHAR_DIGITS
+ \OCP\Security\ISecureRandom::CHAR_HUMAN_READABLE
)
);
}
diff --git a/lib/private/Share20/ProviderFactory.php b/lib/private/Share20/ProviderFactory.php
index aedad6a32a7..2b7d0e78c52 100644
--- a/lib/private/Share20/ProviderFactory.php
+++ b/lib/private/Share20/ProviderFactory.php
@@ -177,6 +177,8 @@ class ProviderFactory implements IProviderFactory {
* Create the circle share provider
*
* @return FederatedShareProvider
+ *
+ * @suppress PhanUndeclaredClassMethod
*/
protected function getShareByCircleProvider() {
diff --git a/lib/private/Template/JSCombiner.php b/lib/private/Template/JSCombiner.php
index 8254174bfc0..8a9e7e747e0 100644
--- a/lib/private/Template/JSCombiner.php
+++ b/lib/private/Template/JSCombiner.php
@@ -28,6 +28,7 @@ use OCP\Files\IAppData;
use OCP\Files\NotFoundException;
use OCP\Files\NotPermittedException;
use OCP\Files\SimpleFS\ISimpleFolder;
+use OCP\ILogger;
use OCP\IURLGenerator;
class JSCombiner {
@@ -44,20 +45,26 @@ class JSCombiner {
/** @var SystemConfig */
protected $config;
+ /** @var ILogger */
+ protected $logger;
+
/**
* @param IAppData $appData
* @param IURLGenerator $urlGenerator
* @param ICache $depsCache
* @param SystemConfig $config
+ * @param ILogger $logger
*/
public function __construct(IAppData $appData,
IURLGenerator $urlGenerator,
ICache $depsCache,
- SystemConfig $config) {
+ SystemConfig $config,
+ ILogger $logger) {
$this->appData = $appData;
$this->urlGenerator = $urlGenerator;
$this->depsCache = $depsCache;
$this->config = $config;
+ $this->logger = $logger;
}
/**
@@ -102,6 +109,12 @@ class JSCombiner {
$depFile = $folder->getFile($fileName);
$deps = $depFile->getContent();
}
+ // check again
+ if ($deps === null || $deps === '') {
+ $this->logger->info('JSCombiner: deps file empty: ' . $fileName);
+ return false;
+ }
+
$deps = json_decode($deps, true);
foreach ($deps as $file=>$mtime) {
diff --git a/lib/private/TemplateLayout.php b/lib/private/TemplateLayout.php
index f7bb23cd3de..9e9ec709cf5 100644
--- a/lib/private/TemplateLayout.php
+++ b/lib/private/TemplateLayout.php
@@ -243,7 +243,8 @@ class TemplateLayout extends \OC_Template {
\OC::$server->getAppDataDir('js'),
\OC::$server->getURLGenerator(),
\OC::$server->getMemCacheFactory()->create('JS'),
- \OC::$server->getSystemConfig()
+ \OC::$server->getSystemConfig(),
+ \OC::$server->getLogger()
)
);
$locator->find($scripts);
diff --git a/lib/private/User/Manager.php b/lib/private/User/Manager.php
index c04f426c2cf..ded807a223b 100644
--- a/lib/private/User/Manager.php
+++ b/lib/private/User/Manager.php
@@ -126,6 +126,9 @@ class Manager extends PublicEmitter implements IUserManager {
* @return \OC\User\User|null Either the user or null if the specified user does not exist
*/
public function get($uid) {
+ if (is_null($uid) || $uid === '' || $uid === false) {
+ return null;
+ }
if (isset($this->cachedUsers[$uid])) { //check the cache first to prevent having to loop over the backends
return $this->cachedUsers[$uid];
}