diff options
-rw-r--r-- | apps/dav/lib/Connector/Sabre/File.php | 4 | ||||
-rw-r--r-- | apps/dav/lib/Provisioning/Apple/AppleProvisioningPlugin.php | 21 | ||||
-rw-r--r-- | apps/user_ldap/ajax/wizard.php | 4 | ||||
-rw-r--r-- | apps/user_ldap/lib/Mapping/AbstractMapping.php | 9 | ||||
-rw-r--r-- | apps/weather_status/lib/Service/WeatherStatusService.php | 18 | ||||
-rw-r--r-- | lib/private/Files/Storage/Wrapper/EncodingDirectoryWrapper.php | 2 | ||||
-rw-r--r-- | lib/private/KnownUser/KnownUserMapper.php | 5 | ||||
-rwxr-xr-x | lib/private/LargeFileHelper.php | 2 | ||||
-rw-r--r-- | lib/private/Preview/Office.php | 2 |
9 files changed, 31 insertions, 36 deletions
diff --git a/apps/dav/lib/Connector/Sabre/File.php b/apps/dav/lib/Connector/Sabre/File.php index 3a871b06259..fd8a6437222 100644 --- a/apps/dav/lib/Connector/Sabre/File.php +++ b/apps/dav/lib/Connector/Sabre/File.php @@ -273,9 +273,9 @@ class File extends Node implements IFile { if ($result === false) { $expected = -1; if (isset($_SERVER['CONTENT_LENGTH'])) { - $expected = $_SERVER['CONTENT_LENGTH']; + $expected = (int)$_SERVER['CONTENT_LENGTH']; } - if ($expected !== "0") { + if ($expected !== 0) { throw new Exception( $this->l10n->t( 'Error while copying file to target location (copied: %1$s, expected filesize: %2$s)', diff --git a/apps/dav/lib/Provisioning/Apple/AppleProvisioningPlugin.php b/apps/dav/lib/Provisioning/Apple/AppleProvisioningPlugin.php index f92bc4f3a0d..98be4e41917 100644 --- a/apps/dav/lib/Provisioning/Apple/AppleProvisioningPlugin.php +++ b/apps/dav/lib/Provisioning/Apple/AppleProvisioningPlugin.php @@ -36,7 +36,6 @@ use Sabre\HTTP\RequestInterface; use Sabre\HTTP\ResponseInterface; class AppleProvisioningPlugin extends ServerPlugin { - /** * @var Server */ @@ -68,23 +67,21 @@ class AppleProvisioningPlugin extends ServerPlugin { protected $l10n; /** - * @var \closure + * @var \Closure */ protected $uuidClosure; /** * AppleProvisioningPlugin constructor. - * - * @param IUserSession $userSession - * @param IURLGenerator $urlGenerator - * @param \OC_Defaults $themingDefaults - * @param IRequest $request - * @param IL10N $l10n - * @param \closure $uuidClosure */ - public function __construct(IUserSession $userSession, IURLGenerator $urlGenerator, - \OC_Defaults $themingDefaults, IRequest $request, - IL10N $l10n, \closure $uuidClosure) { + public function __construct( + IUserSession $userSession, + IURLGenerator $urlGenerator, + \OC_Defaults $themingDefaults, + IRequest $request, + IL10N $l10n, + \Closure $uuidClosure + ) { $this->userSession = $userSession; $this->urlGenerator = $urlGenerator; $this->themingDefaults = $themingDefaults; diff --git a/apps/user_ldap/ajax/wizard.php b/apps/user_ldap/ajax/wizard.php index 8cae22daf19..dcfe9ff76b8 100644 --- a/apps/user_ldap/ajax/wizard.php +++ b/apps/user_ldap/ajax/wizard.php @@ -111,6 +111,10 @@ switch ($action) { \OC_JSON::error(['message' => $l->t('No data specified')]); exit; } + if (is_array($key)) { + \OC_JSON::error(['message' => $l->t('Invalid data specified')]); + exit; + } $cfg = [$key => $val]; $setParameters = []; $configuration->setConfiguration($cfg, $setParameters); diff --git a/apps/user_ldap/lib/Mapping/AbstractMapping.php b/apps/user_ldap/lib/Mapping/AbstractMapping.php index 8fbad6aae3a..3f05091a537 100644 --- a/apps/user_ldap/lib/Mapping/AbstractMapping.php +++ b/apps/user_ldap/lib/Mapping/AbstractMapping.php @@ -27,9 +27,9 @@ namespace OCA\User_LDAP\Mapping; use Doctrine\DBAL\Exception; +use Doctrine\DBAL\Platforms\SqlitePlatform; use OCP\DB\IPreparedStatement; use OCP\DB\QueryBuilder\IQueryBuilder; -use Doctrine\DBAL\Platforms\SqlitePlatform; /** * Class AbstractMapping @@ -191,12 +191,7 @@ abstract class AbstractMapping { * Get the hash to store in database column ldap_dn_hash for a given dn */ protected function getDNHash(string $fdn): string { - $hash = hash('sha256', $fdn, false); - if (is_string($hash)) { - return $hash; - } else { - throw new \RuntimeException('hash function did not return a string'); - } + return hash('sha256', $fdn, false); } /** diff --git a/apps/weather_status/lib/Service/WeatherStatusService.php b/apps/weather_status/lib/Service/WeatherStatusService.php index fa3177b20f6..5b1d926f090 100644 --- a/apps/weather_status/lib/Service/WeatherStatusService.php +++ b/apps/weather_status/lib/Service/WeatherStatusService.php @@ -26,19 +26,19 @@ declare(strict_types=1); */ namespace OCA\WeatherStatus\Service; -use OCP\IConfig; -use OCP\IL10N; -use OCP\App\IAppManager; +use OCA\WeatherStatus\AppInfo\Application; use OCP\Accounts\IAccountManager; use OCP\Accounts\PropertyDoesNotExistException; -use OCP\IUserManager; -use OCP\Http\Client\IClientService; +use OCP\App\IAppManager; use OCP\Http\Client\IClient; -use OCP\ICacheFactory; +use OCP\Http\Client\IClientService; use OCP\ICache; +use OCP\ICacheFactory; +use OCP\IConfig; +use OCP\IL10N; use OCP\ILogger; -use OCA\WeatherStatus\AppInfo\Application; +use OCP\IUserManager; /** * Class WeatherStatusService @@ -426,8 +426,8 @@ class WeatherStatusService { $cacheDuration = 60 * 60; if (isset($headers['Expires']) && count($headers['Expires']) > 0) { // if the Expires response header is set, use it to define cache duration - $expireTs = (new \Datetime($headers['Expires'][0]))->getTimestamp(); - $nowTs = (new \Datetime())->getTimestamp(); + $expireTs = (new \DateTime($headers['Expires'][0]))->getTimestamp(); + $nowTs = (new \DateTime())->getTimestamp(); $duration = $expireTs - $nowTs; if ($duration > $cacheDuration) { $cacheDuration = $duration; diff --git a/lib/private/Files/Storage/Wrapper/EncodingDirectoryWrapper.php b/lib/private/Files/Storage/Wrapper/EncodingDirectoryWrapper.php index 935a15af4cf..3a29b164b01 100644 --- a/lib/private/Files/Storage/Wrapper/EncodingDirectoryWrapper.php +++ b/lib/private/Files/Storage/Wrapper/EncodingDirectoryWrapper.php @@ -31,7 +31,7 @@ use OC\Files\Filesystem; */ class EncodingDirectoryWrapper extends DirectoryWrapper { /** - * @return string + * @return string|false */ public function dir_readdir() { $file = readdir($this->source); diff --git a/lib/private/KnownUser/KnownUserMapper.php b/lib/private/KnownUser/KnownUserMapper.php index 864ece36345..ce7dc9ead63 100644 --- a/lib/private/KnownUser/KnownUserMapper.php +++ b/lib/private/KnownUser/KnownUserMapper.php @@ -32,7 +32,6 @@ use OCP\IDBConnection; * @method KnownUser mapRowToEntity(array $row) */ class KnownUserMapper extends QBMapper { - /** * @param IDBConnection $db */ @@ -49,7 +48,7 @@ class KnownUserMapper extends QBMapper { $query->delete($this->getTableName()) ->where($query->expr()->eq('known_to', $query->createNamedParameter($knownTo))); - return (int) $query->execute(); + return $query->executeStatement(); } /** @@ -61,7 +60,7 @@ class KnownUserMapper extends QBMapper { $query->delete($this->getTableName()) ->where($query->expr()->eq('known_user', $query->createNamedParameter($knownUser))); - return (int) $query->execute(); + return $query->executeStatement(); } /** diff --git a/lib/private/LargeFileHelper.php b/lib/private/LargeFileHelper.php index 82b3c5ae760..a9c5a329620 100755 --- a/lib/private/LargeFileHelper.php +++ b/lib/private/LargeFileHelper.php @@ -50,7 +50,7 @@ class LargeFileHelper { /** * @brief Checks whether our assumptions hold on the PHP platform we are on. * - * @throws \RunTimeException if our assumptions do not hold on the current + * @throws \RuntimeException if our assumptions do not hold on the current * PHP platform. */ public function __construct() { diff --git a/lib/private/Preview/Office.php b/lib/private/Preview/Office.php index 6717584e887..3ba7c5a21a0 100644 --- a/lib/private/Preview/Office.php +++ b/lib/private/Preview/Office.php @@ -71,7 +71,7 @@ abstract class Office extends ProviderV2 { [$dirname, , , $filename] = array_values(pathinfo($absPath)); $pngPreview = $tmpDir . '/' . $filename . '.png'; - $png = new \imagick($pngPreview . '[0]'); + $png = new \Imagick($pngPreview . '[0]'); $png->setImageFormat('jpg'); } catch (\Exception $e) { $this->cleanTmpFiles(); |