Browse Source

Fix a few psalm issues and moved back to psalm/phar 4.18

Signed-off-by: Carl Schwan <carl@carlschwan.eu>
tags/v24.0.0beta1
Carl Schwan 2 years ago
parent
commit
aeecb72e96
No account linked to committer's email address

+ 2
- 2
apps/encryption/lib/Crypto/Crypt.php View File

$encryptedContent = openssl_encrypt($plainContent, $encryptedContent = openssl_encrypt($plainContent,
$cipher, $cipher,
$passPhrase, $passPhrase,
false,
0,
$iv); $iv);


if (!$encryptedContent) { if (!$encryptedContent) {
$plainContent = openssl_decrypt($encryptedContent, $plainContent = openssl_decrypt($encryptedContent,
$cipher, $cipher,
$passPhrase, $passPhrase,
false,
0,
$iv); $iv);


if ($plainContent) { if ($plainContent) {

+ 1
- 1
apps/encryption/lib/KeyManager.php View File

$this->config->setAppValue('encryption', 'masterKeyId', $this->masterKeyId); $this->config->setAppValue('encryption', 'masterKeyId', $this->masterKeyId);
} }


$this->keyId = $userSession && $userSession->isLoggedIn() ? $userSession->getUser()->getUID() : false;
$this->keyId = $userSession->isLoggedIn() ? $userSession->getUser()->getUID() : false;
$this->log = $log; $this->log = $log;
} }



+ 2
- 2
apps/encryption/lib/Migration/SetMasterKeyStatus.php View File



// if no config for the master key is set we set it explicitly to '0' in // if no config for the master key is set we set it explicitly to '0' in
// order not to break old installations because the default changed to '1'. // order not to break old installations because the default changed to '1'.
$configAlreadySet = $this->config->getAppValue('encryption', 'useMasterKey', false);
if ($configAlreadySet === false) {
$configAlreadySet = $this->config->getAppValue('encryption', 'useMasterKey', 'not-set');
if ($configAlreadySet === 'not-set') {
$this->config->setAppValue('encryption', 'useMasterKey', '0'); $this->config->setAppValue('encryption', 'useMasterKey', '0');
} }
} }

+ 1
- 1
apps/encryption/lib/Recovery.php View File

IConfig $config, IConfig $config,
IFile $file, IFile $file,
View $view) { View $view) {
$this->user = ($userSession && $userSession->isLoggedIn()) ? $userSession->getUser() : false;
$this->user = ($userSession->isLoggedIn()) ? $userSession->getUser() : null;
$this->crypt = $crypt; $this->crypt = $crypt;
$this->keyManager = $keyManager; $this->keyManager = $keyManager;
$this->config = $config; $this->config = $config;

+ 1
- 1
apps/files_external/lib/Lib/Storage/FtpConnection.php View File

* Low level wrapper around the ftp functions that smooths over some difference between servers * Low level wrapper around the ftp functions that smooths over some difference between servers
*/ */
class FtpConnection { class FtpConnection {
/** @var resource */
/** @var resource|\FTP\Connection */
private $connection; private $connection;


public function __construct(bool $secure, string $hostname, int $port, string $username, string $password) { public function __construct(bool $secure, string $hostname, int $port, string $username, string $password) {

+ 1
- 4
apps/settings/lib/SetupChecks/CheckUserCertificates.php View File



public function __construct(IL10N $l10n, IConfig $config, IURLGenerator $urlGenerator) { public function __construct(IL10N $l10n, IConfig $config, IURLGenerator $urlGenerator) {
$this->l10n = $l10n; $this->l10n = $l10n;
$configValue = $config->getAppValue('files_external', 'user_certificate_scan', false);
if (!is_string($configValue)) {
$configValue = '';
}
$configValue = $config->getAppValue('files_external', 'user_certificate_scan', '');
$this->configValue = $configValue; $this->configValue = $configValue;
$this->urlGenerator = $urlGenerator; $this->urlGenerator = $urlGenerator;
} }

+ 1
- 1
apps/user_ldap/lib/Access.php View File

} }


$attribute = $this->connection->getFromCache($uuidAttr); $attribute = $this->connection->getFromCache($uuidAttr);
if (!$attribute === null) {
if ($attribute !== null) {
$this->connection->$uuidAttr = $attribute; $this->connection->$uuidAttr = $attribute;
return true; return true;
} }

+ 4
- 2
build/psalm-baseline-ocp.xml View File

<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="4.8.1@f73f2299dbc59a3e6c4d66cff4605176e728ee69">
<files psalm-version="4.18.1@dda05fa913f4dc6eb3386f2f7ce5a45d37a71bcb">
<file src="lib/private/legacy/OC_Image.php"> <file src="lib/private/legacy/OC_Image.php">
<ImplementedReturnTypeMismatch occurrences="1"> <ImplementedReturnTypeMismatch occurrences="1">
<code>null|string</code> <code>null|string</code>
<InvalidReturnType occurrences="1"> <InvalidReturnType occurrences="1">
<code>float</code> <code>float</code>
</InvalidReturnType> </InvalidReturnType>
<UndefinedClass occurrences="12">
<UndefinedClass occurrences="14">
<code>\OC</code>
<code>\OC</code>
<code>\OC</code> <code>\OC</code>
<code>\OC</code> <code>\OC</code>
<code>\OC</code> <code>\OC</code>

+ 234
- 45
build/psalm-baseline.xml View File

<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="4.17.0@6f4707aa41c9174353a6434bba3fc8840f981d9c">
<files psalm-version="4.18.1@dda05fa913f4dc6eb3386f2f7ce5a45d37a71bcb">
<file src="3rdparty/sabre/dav/lib/CalDAV/Calendar.php"> <file src="3rdparty/sabre/dav/lib/CalDAV/Calendar.php">
<MoreSpecificImplementedParamType occurrences="1"> <MoreSpecificImplementedParamType occurrences="1">
<code>$calendarData</code> <code>$calendarData</code>
<code>array</code> <code>array</code>
</LessSpecificImplementedReturnType> </LessSpecificImplementedReturnType>
</file> </file>
<file src="apps/admin_audit/lib/AppInfo/Application.php">
<InvalidArgument occurrences="1">
<code>registerEventListener</code>
</InvalidArgument>
</file>
<file src="apps/cloud_federation_api/lib/Controller/RequestHandlerController.php"> <file src="apps/cloud_federation_api/lib/Controller/RequestHandlerController.php">
<InvalidScalarArgument occurrences="1"> <InvalidScalarArgument occurrences="1">
<code>$e-&gt;getCode()</code> <code>$e-&gt;getCode()</code>
<code>!is_array($notification)</code> <code>!is_array($notification)</code>
</TypeDoesNotContainType> </TypeDoesNotContainType>
</file> </file>
<file src="apps/comments/lib/AppInfo/Application.php">
<InvalidArgument occurrences="2">
<code>registerEventListener</code>
<code>registerEventListener</code>
</InvalidArgument>
</file>
<file src="apps/comments/lib/Search/Result.php"> <file src="apps/comments/lib/Search/Result.php">
<InvalidScalarArgument occurrences="1"> <InvalidScalarArgument occurrences="1">
<code>(int) $comment-&gt;getId()</code> <code>(int) $comment-&gt;getId()</code>
<code>\Sabre\Uri\split($this-&gt;principalUri)</code> <code>\Sabre\Uri\split($this-&gt;principalUri)</code>
</UndefinedFunction> </UndefinedFunction>
</file> </file>
<file src="apps/contactsinteraction/lib/AppInfo/Application.php">
<InvalidArgument occurrences="1">
<code>registerEventListener</code>
</InvalidArgument>
</file>
<file src="apps/dav/appinfo/v1/caldav.php"> <file src="apps/dav/appinfo/v1/caldav.php">
<TooManyArguments occurrences="1"> <TooManyArguments occurrences="1">
<code>new \Sabre\DAV\Auth\Plugin($authBackend, 'ownCloud')</code> <code>new \Sabre\DAV\Auth\Plugin($authBackend, 'ownCloud')</code>
</MissingFile> </MissingFile>
</file> </file>
<file src="apps/dav/lib/AppInfo/Application.php"> <file src="apps/dav/lib/AppInfo/Application.php">
<InvalidArgument occurrences="28">
<code>registerEventListener</code>
<code>registerEventListener</code>
<code>registerEventListener</code>
<code>registerEventListener</code>
<code>registerEventListener</code>
<code>registerEventListener</code>
<code>registerEventListener</code>
<code>registerEventListener</code>
<code>registerEventListener</code>
<code>registerEventListener</code>
<code>registerEventListener</code>
<code>registerEventListener</code>
<code>registerEventListener</code>
<code>registerEventListener</code>
<code>registerEventListener</code>
<code>registerEventListener</code>
<code>registerEventListener</code>
<code>registerEventListener</code>
<code>registerEventListener</code>
<code>registerEventListener</code>
<code>registerEventListener</code>
<code>registerEventListener</code>
<code>registerEventListener</code>
<code>registerEventListener</code>
<code>registerEventListener</code>
<code>registerEventListener</code>
<code>registerEventListener</code>
<code>registerEventListener</code>
</InvalidArgument>
<UndefinedInterfaceMethod occurrences="1"> <UndefinedInterfaceMethod occurrences="1">
<code>getAppDataDir</code> <code>getAppDataDir</code>
</UndefinedInterfaceMethod> </UndefinedInterfaceMethod>
<code>@var VEvent $vevent</code> <code>@var VEvent $vevent</code>
</PossiblyInvalidDocblockTag> </PossiblyInvalidDocblockTag>
</file> </file>
<file src="apps/dav/lib/CalDAV/Reminder/NotificationProviderManager.php">
<UndefinedConstant occurrences="1">
<code>$provider::NOTIFICATION_TYPE</code>
</UndefinedConstant>
</file>
<file src="apps/dav/lib/CalDAV/Reminder/Notifier.php"> <file src="apps/dav/lib/CalDAV/Reminder/Notifier.php">
<FalsableReturnStatement occurrences="4"> <FalsableReturnStatement occurrences="4">
<code>$this-&gt;l10n-&gt;l('date', $dt, ['width' =&gt; 'medium'])</code> <code>$this-&gt;l10n-&gt;l('date', $dt, ['width' =&gt; 'medium'])</code>
<InvalidReturnType occurrences="1"> <InvalidReturnType occurrences="1">
<code>array</code> <code>array</code>
</InvalidReturnType> </InvalidReturnType>
<RedundantFunctionCall occurrences="1">
<code>array_values</code>
</RedundantFunctionCall>
</file> </file>
<file src="apps/dav/lib/Upload/UploadHome.php"> <file src="apps/dav/lib/Upload/UploadHome.php">
<UndefinedFunction occurrences="1"> <UndefinedFunction occurrences="1">
</InvalidOperand> </InvalidOperand>
</file> </file>
<file src="apps/encryption/lib/Crypto/Crypt.php"> <file src="apps/encryption/lib/Crypto/Crypt.php">
<RedundantCondition occurrences="1">
<RedundantCondition occurrences="2">
<code>$userSession</code>
<code>$userSession</code> <code>$userSession</code>
</RedundantCondition> </RedundantCondition>
<TypeDoesNotContainType occurrences="2"> <TypeDoesNotContainType occurrences="2">
<InvalidThrow occurrences="1"> <InvalidThrow occurrences="1">
<code>throw $exception;</code> <code>throw $exception;</code>
</InvalidThrow> </InvalidThrow>
<RedundantCondition occurrences="1">
<code>$userSession</code>
</RedundantCondition>
</file> </file>
<file src="apps/encryption/lib/Recovery.php"> <file src="apps/encryption/lib/Recovery.php">
<InvalidScalarArgument occurrences="3"> <InvalidScalarArgument occurrences="3">
<code>0</code> <code>0</code>
<code>1</code> <code>1</code>
</InvalidScalarArgument> </InvalidScalarArgument>
<RedundantCondition occurrences="1">
<code>$userSession</code>
</RedundantCondition>
</file> </file>
<file src="apps/encryption/lib/Session.php"> <file src="apps/encryption/lib/Session.php">
<TooManyArguments occurrences="1"> <TooManyArguments occurrences="1">
</TooManyArguments> </TooManyArguments>
</file> </file>
<file src="apps/encryption/lib/Util.php"> <file src="apps/encryption/lib/Util.php">
<RedundantCondition occurrences="1">
<RedundantCondition occurrences="2">
<code>$userSession</code>
<code>$userSession</code> <code>$userSession</code>
</RedundantCondition> </RedundantCondition>
</file> </file>
<file src="apps/federatedfilesharing/lib/AppInfo/Application.php">
<InvalidArgument occurrences="1">
<code>registerEventListener</code>
</InvalidArgument>
</file>
<file src="apps/federatedfilesharing/lib/Controller/RequestHandlerController.php"> <file src="apps/federatedfilesharing/lib/Controller/RequestHandlerController.php">
<InvalidScalarArgument occurrences="7"> <InvalidScalarArgument occurrences="7">
<code>$id</code> <code>$id</code>
<code>null</code> <code>null</code>
</NullableReturnStatement> </NullableReturnStatement>
</file> </file>
<file src="apps/federation/lib/AppInfo/Application.php">
<InvalidArgument occurrences="1">
<code>registerEventListener</code>
</InvalidArgument>
</file>
<file src="apps/federation/lib/TrustedServers.php"> <file src="apps/federation/lib/TrustedServers.php">
<InvalidArgument occurrences="1"> <InvalidArgument occurrences="1">
<code>'OCP\Federation\TrustedServerEvent::remove'</code> <code>'OCP\Federation\TrustedServerEvent::remove'</code>
<code>10 * 1024 * 1024</code> <code>10 * 1024 * 1024</code>
</InvalidScalarArgument> </InvalidScalarArgument>
</file> </file>
<file src="apps/files/lib/AppInfo/Application.php">
<InvalidArgument occurrences="2">
<code>registerEventListener</code>
<code>registerEventListener</code>
</InvalidArgument>
</file>
<file src="apps/files/lib/Command/Scan.php"> <file src="apps/files/lib/Command/Scan.php">
<NullArgument occurrences="1"> <NullArgument occurrences="1">
<code>null</code> <code>null</code>
<code>$this</code> <code>$this</code>
</InvalidScope> </InvalidScope>
</file> </file>
<file src="apps/files_external/lib/AppInfo/Application.php">
<InvalidArgument occurrences="2">
<code>registerEventListener</code>
<code>registerEventListener</code>
</InvalidArgument>
</file>
<file src="apps/files_external/lib/Command/Delete.php"> <file src="apps/files_external/lib/Command/Delete.php">
<NullArgument occurrences="1"> <NullArgument occurrences="1">
<code>null</code> <code>null</code>
<code>getUniqueStorages</code> <code>getUniqueStorages</code>
</UndefinedMethod> </UndefinedMethod>
</file> </file>
<file src="apps/files_external/lib/Lib/Auth/Password/LoginCredentials.php">
<InvalidArgument occurrences="2">
<code>addServiceListener</code>
<code>addServiceListener</code>
</InvalidArgument>
</file>
<file src="apps/files_external/lib/Lib/Backend/Backend.php"> <file src="apps/files_external/lib/Lib/Backend/Backend.php">
<InvalidReturnType occurrences="1"> <InvalidReturnType occurrences="1">
<code>self</code> <code>self</code>
<code>$_</code> <code>$_</code>
</UndefinedVariable> </UndefinedVariable>
</file> </file>
<file src="apps/files_sharing/lib/AppInfo/Application.php">
<InvalidArgument occurrences="6">
<code>addServiceListener</code>
<code>addServiceListener</code>
<code>addServiceListener</code>
<code>addServiceListener</code>
<code>addServiceListener</code>
<code>addServiceListener</code>
</InvalidArgument>
</file>
<file src="apps/files_sharing/lib/Cache.php"> <file src="apps/files_sharing/lib/Cache.php">
<FalsableReturnStatement occurrences="1"> <FalsableReturnStatement occurrences="1">
<code>false</code> <code>false</code>
</UndefinedInterfaceMethod> </UndefinedInterfaceMethod>
</file> </file>
<file src="apps/files_sharing/lib/Controller/ShareAPIController.php"> <file src="apps/files_sharing/lib/Controller/ShareAPIController.php">
<InvalidOperand occurrences="1">
<code>$permissions</code>
</InvalidOperand>
<InvalidScalarArgument occurrences="3"> <InvalidScalarArgument occurrences="3">
<code>$code</code> <code>$code</code>
<code>$code</code> <code>$code</code>
<code>Constants::PERMISSION_ALL</code> <code>Constants::PERMISSION_ALL</code>
</InvalidScalarArgument> </InvalidScalarArgument>
<RedundantCondition occurrences="1">
<code>$permissions &amp; Constants::PERMISSION_READ</code>
</RedundantCondition>
<UndefinedClass occurrences="2"> <UndefinedClass occurrences="2">
<code>\OCA\Circles\Api\v1\Circles</code> <code>\OCA\Circles\Api\v1\Circles</code>
<code>\OCA\Circles\Api\v1\Circles</code> <code>\OCA\Circles\Api\v1\Circles</code>
<code>$exception-&gt;getMessage()</code> <code>$exception-&gt;getMessage()</code>
</InvalidArgument> </InvalidArgument>
</file> </file>
<file src="apps/files_sharing/lib/MountProvider.php">
<RedundantFunctionCall occurrences="1">
<code>array_values</code>
</RedundantFunctionCall>
</file>
<file src="apps/files_sharing/lib/ShareBackend/File.php"> <file src="apps/files_sharing/lib/ShareBackend/File.php">
<InvalidScalarArgument occurrences="2"> <InvalidScalarArgument occurrences="2">
<code>$itemSource</code> <code>$itemSource</code>
</TooManyArguments> </TooManyArguments>
</file> </file>
<file src="apps/files_trashbin/lib/Trash/LegacyTrashBackend.php"> <file src="apps/files_trashbin/lib/Trash/LegacyTrashBackend.php">
<RedundantCondition occurrences="1">
<RedundantCondition occurrences="2">
<code>$trashFiles</code>
<code>$trashFiles</code> <code>$trashFiles</code>
</RedundantCondition> </RedundantCondition>
<TypeDoesNotContainType occurrences="1">
<code>null</code>
</TypeDoesNotContainType>
<UndefinedInterfaceMethod occurrences="2"> <UndefinedInterfaceMethod occurrences="2">
<code>$file</code> <code>$file</code>
<code>getById</code> <code>getById</code>
<code>$this</code> <code>$this</code>
</InvalidScope> </InvalidScope>
</file> </file>
<file src="apps/files_versions/lib/AppInfo/Application.php">
<InvalidArgument occurrences="2">
<code>registerEventListener</code>
<code>registerEventListener</code>
</InvalidArgument>
</file>
<file src="apps/files_versions/lib/Sabre/RestoreFolder.php"> <file src="apps/files_versions/lib/Sabre/RestoreFolder.php">
<InvalidNullableReturnType occurrences="1"> <InvalidNullableReturnType occurrences="1">
<code>getChild</code> <code>getChild</code>
<file src="apps/oauth2/lib/Db/ClientMapper.php"> <file src="apps/oauth2/lib/Db/ClientMapper.php">
<InvalidCatch occurrences="2"/> <InvalidCatch occurrences="2"/>
</file> </file>
<file src="apps/provisioning_api/lib/AppInfo/Application.php">
<InvalidArgument occurrences="1">
<code>registerEventListener</code>
</InvalidArgument>
</file>
<file src="apps/provisioning_api/lib/Controller/UsersController.php"> <file src="apps/provisioning_api/lib/Controller/UsersController.php">
<InvalidScalarArgument occurrences="1"> <InvalidScalarArgument occurrences="1">
<code>$quota</code> <code>$quota</code>
</TypeDoesNotContainNull> </TypeDoesNotContainNull>
</file> </file>
<file src="apps/settings/lib/AppInfo/Application.php"> <file src="apps/settings/lib/AppInfo/Application.php">
<InvalidArgument occurrences="3">
<code>registerEventListener</code>
<code>registerEventListener</code>
<code>registerEventListener</code>
</InvalidArgument>
<InvalidScalarArgument occurrences="1"> <InvalidScalarArgument occurrences="1">
<code>\OC_User::getUser()</code> <code>\OC_User::getUser()</code>
</InvalidScalarArgument> </InvalidScalarArgument>
<code>isReady</code> <code>isReady</code>
</UndefinedInterfaceMethod> </UndefinedInterfaceMethod>
</file> </file>
<file src="apps/settings/lib/Settings/Admin/Server.php">
<InvalidArgument occurrences="1">
<code>false</code>
</InvalidArgument>
</file>
<file src="apps/settings/lib/Settings/Admin/Sharing.php"> <file src="apps/settings/lib/Settings/Admin/Sharing.php">
<InvalidScalarArgument occurrences="1"> <InvalidScalarArgument occurrences="1">
<code>Constants::PERMISSION_ALL</code> <code>Constants::PERMISSION_ALL</code>
<code>$type</code> <code>$type</code>
</InvalidScalarArgument> </InvalidScalarArgument>
</file> </file>
<file src="apps/theming/lib/AppInfo/Application.php">
<InvalidArgument occurrences="1">
<code>registerEventListener</code>
</InvalidArgument>
</file>
<file src="apps/theming/lib/Controller/IconController.php"> <file src="apps/theming/lib/Controller/IconController.php">
<InvalidReturnStatement occurrences="1"> <InvalidReturnStatement occurrences="1">
<code>$response</code> <code>$response</code>
<code>$folder !== null</code> <code>$folder !== null</code>
</RedundantCondition> </RedundantCondition>
</file> </file>
<file src="apps/twofactor_backupcodes/lib/AppInfo/Application.php">
<InvalidArgument occurrences="4">
<code>registerEventListener</code>
<code>registerEventListener</code>
<code>registerEventListener</code>
<code>registerEventListener</code>
</InvalidArgument>
</file>
<file src="apps/twofactor_backupcodes/lib/BackgroundJob/RememberBackupCodesJob.php"> <file src="apps/twofactor_backupcodes/lib/BackgroundJob/RememberBackupCodesJob.php">
<InvalidArgument occurrences="1"> <InvalidArgument occurrences="1">
<code>bool</code> <code>bool</code>
</InvalidScalarArgument> </InvalidScalarArgument>
</file> </file>
<file src="apps/updatenotification/lib/Notification/BackgroundJob.php"> <file src="apps/updatenotification/lib/Notification/BackgroundJob.php">
<InvalidArgument occurrences="1">
<code>false</code>
</InvalidArgument>
<InvalidPropertyAssignmentValue occurrences="1"> <InvalidPropertyAssignmentValue occurrences="1">
<code>$this-&gt;users</code> <code>$this-&gt;users</code>
</InvalidPropertyAssignmentValue> </InvalidPropertyAssignmentValue>
</InvalidPropertyAssignmentValue> </InvalidPropertyAssignmentValue>
<InvalidReturnType occurrences="1"> <InvalidReturnType occurrences="1">
<code>null</code> <code>null</code>
<code>null</code>
</InvalidReturnType> </InvalidReturnType>
<InvalidScalarArgument occurrences="3"> <InvalidScalarArgument occurrences="3">
<code>$this-&gt;getHomePath($ldapEntry[$attr][0])</code> <code>$this-&gt;getHomePath($ldapEntry[$attr][0])</code>
</TypeDoesNotContainType> </TypeDoesNotContainType>
</file> </file>
<file src="apps/user_status/lib/AppInfo/Application.php"> <file src="apps/user_status/lib/AppInfo/Application.php">
<InvalidArgument occurrences="3">
<code>registerEventListener</code>
<code>registerEventListener</code>
<code>registerEventListener</code>
</InvalidArgument>
<UndefinedInterfaceMethod occurrences="1"> <UndefinedInterfaceMethod occurrences="1">
<code>registerProvider</code> <code>registerProvider</code>
</UndefinedInterfaceMethod> </UndefinedInterfaceMethod>
</file> </file>
<file src="apps/workflowengine/lib/AppInfo/Application.php">
<InvalidArgument occurrences="1">
<code>registerEventListener</code>
</InvalidArgument>
</file>
<file src="apps/workflowengine/lib/Check/AbstractStringCheck.php"> <file src="apps/workflowengine/lib/Check/AbstractStringCheck.php">
<NullArgument occurrences="1"> <NullArgument occurrences="1">
<code>null</code> <code>null</code>
<code>isUserScopeEnabled</code> <code>isUserScopeEnabled</code>
</UndefinedInterfaceMethod> </UndefinedInterfaceMethod>
</file> </file>
<file src="core/Application.php">
<InvalidArgument occurrences="9">
<code>addServiceListener</code>
<code>addServiceListener</code>
<code>addServiceListener</code>
<code>addServiceListener</code>
<code>addServiceListener</code>
<code>addServiceListener</code>
<code>addServiceListener</code>
<code>addServiceListener</code>
<code>addServiceListener</code>
</InvalidArgument>
</file>
<file src="core/BackgroundJobs/BackgroundCleanupUpdaterBackupsJob.php"> <file src="core/BackgroundJobs/BackgroundCleanupUpdaterBackupsJob.php">
<ParamNameMismatch occurrences="1"> <ParamNameMismatch occurrences="1">
<code>$arguments</code> <code>$arguments</code>
<code>$arguments</code> <code>$arguments</code>
</ParamNameMismatch> </ParamNameMismatch>
</file> </file>
<file src="core/Command/App/GetPath.php">
<ImplementedReturnTypeMismatch occurrences="1">
<code>null|int</code>
</ImplementedReturnTypeMismatch>
<MismatchingDocblockReturnType occurrences="1">
<code>null|int</code>
</MismatchingDocblockReturnType>
</file>
<file src="core/Command/App/Install.php"> <file src="core/Command/App/Install.php">
<TypeDoesNotContainType occurrences="1"> <TypeDoesNotContainType occurrences="1">
<code>$result === false</code> <code>$result === false</code>
<code>array</code> <code>array</code>
</LessSpecificImplementedReturnType> </LessSpecificImplementedReturnType>
</file> </file>
<file src="core/Command/Config/App/GetConfig.php">
<ImplementedReturnTypeMismatch occurrences="1">
<code>null|int</code>
</ImplementedReturnTypeMismatch>
<MismatchingDocblockReturnType occurrences="1">
<code>null|int</code>
</MismatchingDocblockReturnType>
</file>
<file src="core/Command/Config/Import.php"> <file src="core/Command/Config/Import.php">
<InvalidScalarArgument occurrences="2"> <InvalidScalarArgument occurrences="2">
<code>0</code> <code>0</code>
<code>getFilteredValues</code> <code>getFilteredValues</code>
</TooManyArguments> </TooManyArguments>
</file> </file>
<file src="core/Command/Config/System/GetConfig.php">
<ImplementedReturnTypeMismatch occurrences="1">
<code>null|int</code>
</ImplementedReturnTypeMismatch>
<MismatchingDocblockReturnType occurrences="1">
<code>null|int</code>
</MismatchingDocblockReturnType>
</file>
<file src="core/Command/Db/AddMissingColumns.php"> <file src="core/Command/Db/AddMissingColumns.php">
<InvalidArgument occurrences="1"> <InvalidArgument occurrences="1">
<code>IDBConnection::ADD_MISSING_COLUMNS_EVENT</code> <code>IDBConnection::ADD_MISSING_COLUMNS_EVENT</code>
<code>$this</code> <code>$this</code>
</InvalidScope> </InvalidScope>
</file> </file>
<file src="core/templates/layout.guest.php">
<InvalidArgument occurrences="1">
<code>false</code>
</InvalidArgument>
</file>
<file src="core/templates/layout.public.php"> <file src="core/templates/layout.public.php">
<UndefinedInterfaceMethod occurrences="1"> <UndefinedInterfaceMethod occurrences="1">
<code>getIcon</code> <code>getIcon</code>
</UndefinedInterfaceMethod> </UndefinedInterfaceMethod>
</file> </file>
<file src="lib/autoloader.php"> <file src="lib/autoloader.php">
<RedundantCondition occurrences="1">
<RedundantCondition occurrences="2">
<code>$this-&gt;memoryCache</code>
<code>$this-&gt;memoryCache</code> <code>$this-&gt;memoryCache</code>
</RedundantCondition> </RedundantCondition>
</file> </file>
<code>getAppsNeedingUpgrade</code> <code>getAppsNeedingUpgrade</code>
<code>getIncompatibleApps</code> <code>getIncompatibleApps</code>
</InternalMethod> </InternalMethod>
<InvalidArgument occurrences="1">
<InvalidArgument occurrences="3">
<code>$restrictions</code> <code>$restrictions</code>
<code>addServiceListener</code>
<code>addServiceListener</code>
</InvalidArgument> </InvalidArgument>
<RedundantCondition occurrences="1"> <RedundantCondition occurrences="1">
<code>((array)$request-&gt;getParam('appid')) !== ''</code> <code>((array)$request-&gt;getParam('appid')) !== ''</code>
<NullableReturnStatement occurrences="1"> <NullableReturnStatement occurrences="1">
<code>null</code> <code>null</code>
</NullableReturnStatement> </NullableReturnStatement>
<RedundantCondition occurrences="1">
<RedundantCondition occurrences="2">
<code>$userObject</code>
<code>$userObject</code> <code>$userObject</code>
</RedundantCondition> </RedundantCondition>
<TooManyArguments occurrences="1"> <TooManyArguments occurrences="1">
</MoreSpecificImplementedParamType> </MoreSpecificImplementedParamType>
</file> </file>
<file src="lib/private/Files/ObjectStore/ObjectStoreStorage.php"> <file src="lib/private/Files/ObjectStore/ObjectStoreStorage.php">
<InvalidScalarArgument occurrences="1">
<code>$source</code>
</InvalidScalarArgument>
<ParamNameMismatch occurrences="2"> <ParamNameMismatch occurrences="2">
<code>$source</code> <code>$source</code>
<code>$target</code> <code>$target</code>
</InvalidReturnType> </InvalidReturnType>
</file> </file>
<file src="lib/private/Files/Storage/Wrapper/Encoding.php"> <file src="lib/private/Files/Storage/Wrapper/Encoding.php">
<InvalidScalarArgument occurrences="3">
<code>\Normalizer::FORM_C</code>
<code>\Normalizer::FORM_C</code>
<code>\Normalizer::FORM_D</code>
</InvalidScalarArgument>
<UndefinedInterfaceMethod occurrences="13"> <UndefinedInterfaceMethod occurrences="13">
<code>$this-&gt;namesCache</code> <code>$this-&gt;namesCache</code>
<code>$this-&gt;namesCache</code> <code>$this-&gt;namesCache</code>
<code>stream_flush</code> <code>stream_flush</code>
</InvalidReturnType> </InvalidReturnType>
</file> </file>
<file src="lib/private/Files/Template/TemplateManager.php">
<RedundantCondition occurrences="1">
<code>!$isDefaultTemplates</code>
</RedundantCondition>
</file>
<file src="lib/private/Files/Type/Detection.php"> <file src="lib/private/Files/Type/Detection.php">
<ParamNameMismatch occurrences="1"> <ParamNameMismatch occurrences="1">
<code>$mimetype</code> <code>$mimetype</code>
<code>null</code> <code>null</code>
<code>null</code> <code>null</code>
</NullableReturnStatement> </NullableReturnStatement>
<RedundantCondition occurrences="3">
<code>$data</code>
<RedundantCondition occurrences="5">
<code>$result</code>
<code>$result &amp;&amp; in_array('delete', $hooks) and $result</code> <code>$result &amp;&amp; in_array('delete', $hooks) and $result</code>
<code>Constants::PERMISSION_READ</code>
<code>Constants::PERMISSION_READ</code>
<code>is_resource($source)</code> <code>is_resource($source)</code>
</RedundantCondition> </RedundantCondition>
<UndefinedDocblockClass occurrences="2"> <UndefinedDocblockClass occurrences="2">
<MoreSpecificImplementedParamType occurrences="1"> <MoreSpecificImplementedParamType occurrences="1">
<code>$user</code> <code>$user</code>
</MoreSpecificImplementedParamType> </MoreSpecificImplementedParamType>
<RedundantCondition occurrences="3">
<RedundantCondition occurrences="6">
<code>$this-&gt;emitter</code>
<code>$this-&gt;emitter</code>
<code>$this-&gt;emitter</code>
<code>$this-&gt;emitter</code> <code>$this-&gt;emitter</code>
<code>$this-&gt;emitter</code> <code>$this-&gt;emitter</code>
<code>$this-&gt;emitter</code> <code>$this-&gt;emitter</code>
<FalsableReturnStatement occurrences="1"> <FalsableReturnStatement occurrences="1">
<code>false</code> <code>false</code>
</FalsableReturnStatement> </FalsableReturnStatement>
<InvalidArgument occurrences="2">
<code>false</code>
<code>false</code>
</InvalidArgument>
<InvalidArrayOffset occurrences="2"> <InvalidArrayOffset occurrences="2">
<code>$app['path']</code> <code>$app['path']</code>
<code>$app['path']</code> <code>$app['path']</code>
<NullArgument occurrences="1"> <NullArgument occurrences="1">
<code>null</code> <code>null</code>
</NullArgument> </NullArgument>
<RedundantCondition occurrences="1">
<code>$archive</code>
</RedundantCondition>
</file> </file>
<file src="lib/private/IntegrityCheck/Checker.php"> <file src="lib/private/IntegrityCheck/Checker.php">
<InvalidArrayAccess occurrences="3"> <InvalidArrayAccess occurrences="3">
</InvalidPropertyAssignmentValue> </InvalidPropertyAssignmentValue>
</file> </file>
<file src="lib/private/Log.php"> <file src="lib/private/Log.php">
<RedundantCondition occurrences="1">
<RedundantCondition occurrences="2">
<code>$request</code>
<code>$request</code> <code>$request</code>
</RedundantCondition> </RedundantCondition>
</file> </file>
<code>dispatch</code> <code>dispatch</code>
</TooManyArguments> </TooManyArguments>
</file> </file>
<file src="lib/private/Repair/Owncloud/CleanPreviews.php">
<InvalidArgument occurrences="1">
<code>false</code>
</InvalidArgument>
</file>
<file src="lib/private/Repair/Owncloud/CleanPreviewsBackgroundJob.php"> <file src="lib/private/Repair/Owncloud/CleanPreviewsBackgroundJob.php">
<ParamNameMismatch occurrences="1"> <ParamNameMismatch occurrences="1">
<code>$arguments</code> <code>$arguments</code>
<ParamNameMismatch occurrences="1"> <ParamNameMismatch occurrences="1">
<code>$arguments</code> <code>$arguments</code>
</ParamNameMismatch> </ParamNameMismatch>
<TypeDoesNotContainType occurrences="1">
<code>$counter % 100 === 0</code>
</TypeDoesNotContainType>
</file> </file>
<file src="lib/private/Repair/RemoveLinkShares.php"> <file src="lib/private/Repair/RemoveLinkShares.php">
<ImplicitToStringCast occurrences="2"> <ImplicitToStringCast occurrences="2">
<code>dispatch</code> <code>dispatch</code>
</TooManyArguments> </TooManyArguments>
</file> </file>
<file src="lib/private/TagManager.php">
<InvalidNullableReturnType occurrences="1">
<code>\OCP\ITags</code>
</InvalidNullableReturnType>
<NullableReturnStatement occurrences="1">
<code>null</code>
</NullableReturnStatement>
</file>
<file src="lib/private/Tags.php"> <file src="lib/private/Tags.php">
<InvalidArgument occurrences="1"> <InvalidArgument occurrences="1">
<code>[$this-&gt;user, $this-&gt;type, $chunk]</code> <code>[$this-&gt;user, $this-&gt;type, $chunk]</code>
</NullArgument> </NullArgument>
</file> </file>
<file src="lib/private/Template/JSResourceLocator.php"> <file src="lib/private/Template/JSResourceLocator.php">
<InvalidArgument occurrences="1">
<code>false</code>
</InvalidArgument>
<InvalidOperand occurrences="6"> <InvalidOperand occurrences="6">
<code>$this-&gt;appendIfExist($this-&gt;serverroot, $script.'.js')</code> <code>$this-&gt;appendIfExist($this-&gt;serverroot, $script.'.js')</code>
<code>$this-&gt;appendIfExist($this-&gt;serverroot, $theme_dir.$script.'.js')</code> <code>$this-&gt;appendIfExist($this-&gt;serverroot, $theme_dir.$script.'.js')</code>
<ImplementedReturnTypeMismatch occurrences="1"> <ImplementedReturnTypeMismatch occurrences="1">
<code>array|int</code> <code>array|int</code>
</ImplementedReturnTypeMismatch> </ImplementedReturnTypeMismatch>
<InvalidArgument occurrences="1">
<code>$callback</code>
</InvalidArgument>
<InvalidNullableReturnType occurrences="1"> <InvalidNullableReturnType occurrences="1">
<code>bool|IUser</code> <code>bool|IUser</code>
</InvalidNullableReturnType> </InvalidNullableReturnType>

+ 74
- 0
build/stubs/ftp.php View File

<?php

/** @generate-class-entries */

namespace FTP {

/**
* @strict-properties
* @not-serializable
*/
final class Connection
{
}

}

namespace {

function ftp_connect(string $hostname, int $port = 21, int $timeout = 90): FTP\Connection|resource|false {}

#ifdef HAVE_FTP_SSL
function ftp_ssl_connect(string $hostname, int $port = 21, int $timeout = 90): FTP\Connection|resource|false {}
#endif

function ftp_login(FTP\Connection|resource $ftp, string $username, string $password): bool {}
function ftp_pwd(FTP\Connection|resource $ftp): string|false {}
function ftp_cdup(FTP\Connection|resource $ftp): bool {}
function ftp_chdir(FTP\Connection|resource $ftp, string $directory): bool {}
function ftp_exec(FTP\Connection|resource $ftp, string $command): bool {}
function ftp_raw(FTP\Connection|resource $ftp, string $command): ?array {}
function ftp_mkdir(FTP\Connection|resource $ftp, string $directory): string|false {}
function ftp_rmdir(FTP\Connection|resource $ftp, string $directory): bool {}
function ftp_chmod(FTP\Connection|resource $ftp, int $permissions, string $filename): int|false {}

/** @param string $response */
function ftp_alloc(FTP\Connection|resource $ftp, int $size, &$response = null): bool {}
function ftp_nlist(FTP\Connection|resource $ftp, string $directory): array|false {}
function ftp_rawlist(FTP\Connection|resource $ftp, string $directory, bool $recursive = false): array|false {}
function ftp_mlsd(FTP\Connection|resource $ftp, string $directory): array|false {}
function ftp_systype(FTP\Connection|resource $ftp): string|false {}

/** @param resource $stream */
function ftp_fget(FTP\Connection|resource $ftp, $stream, string $remote_filename, int $mode = FTP_BINARY, int $offset = 0): bool {}

/** @param resource $stream */
function ftp_nb_fget(FTP\Connection|resource $ftp, $stream, string $remote_filename, int $mode = FTP_BINARY, int $offset = 0): int {}
function ftp_pasv(FTP\Connection|resource $ftp, bool $enable): bool {}
function ftp_get(FTP\Connection|resource $ftp, string $local_filename, string $remote_filename, int $mode = FTP_BINARY, int $offset = 0): bool {}
function ftp_nb_get(FTP\Connection|resource $ftp, string $local_filename, string $remote_filename, int $mode = FTP_BINARY, int $offset = 0): int {}
function ftp_nb_continue(FTP\Connection|resource $ftp): int {}

/** @param resource $stream */
function ftp_fput(FTP\Connection|resource $ftp, string $remote_filename, $stream, int $mode = FTP_BINARY, int $offset = 0): bool {}

/** @param resource $stream */
function ftp_nb_fput(FTP\Connection|resource $ftp, string $remote_filename, $stream, int $mode = FTP_BINARY, int $offset = 0): int {}
function ftp_put(FTP\Connection|resource $ftp, string $remote_filename, string $local_filename, int $mode = FTP_BINARY, int $offset = 0): bool {}
function ftp_append(FTP\Connection|resource $ftp, string $remote_filename, string $local_filename, int $mode = FTP_BINARY): bool {}
function ftp_nb_put(FTP\Connection|resource $ftp, string $remote_filename, string $local_filename, int $mode = FTP_BINARY, int $offset = 0): int|false {}
function ftp_size(FTP\Connection|resource $ftp, string $filename): int {}
function ftp_mdtm(FTP\Connection|resource $ftp, string $filename): int {}
function ftp_rename(FTP\Connection|resource $ftp, string $from, string $to): bool {}
function ftp_delete(FTP\Connection|resource $ftp, string $filename): bool {}
function ftp_site(FTP\Connection|resource $ftp, string $command): bool {}
function ftp_close(FTP\Connection|resource $ftp): bool {}

/** @alias ftp_close */
function ftp_quit(FTP\Connection|resource $ftp): bool {}

/** @param int|bool $value */
function ftp_set_option(FTP\Connection|resource $ftp, int $option, $value): bool {}
function ftp_get_option(FTP\Connection|resource $ftp, int $option): int|bool {}

}

+ 6
- 0
build/stubs/gd.php View File

<?php <?php


/**
* @strict-properties
* @not-serializable
*/
final class GdImage {}

/** /**
* Retrieve information about the currently installed GD library * Retrieve information about the currently installed GD library
* @link https://php.net/manual/en/function.gd-info.php * @link https://php.net/manual/en/function.gd-info.php

+ 26
- 1558
build/stubs/ldap.php
File diff suppressed because it is too large
View File


+ 50
- 0
build/stubs/pcntl.php View File

<?php

// Licensed under Apache-2.0
// Copied from https://github.com/JetBrains/phpstorm-stubs/blob/master/pcntl/pcntl.php

define('WNOHANG', 1);
define('WUNTRACED', 2);
define('WCONTINUED', 8);
define('SIG_IGN', 1);
define('SIG_DFL', 0);
define('SIG_ERR', -1);
define('SIGHUP', 1);
define('SIGINT', 2);
define('SIGQUIT', 3);
define('SIGILL', 4);
define('SIGTRAP', 5);
define('SIGABRT', 6);
define('SIGIOT', 6);
define('SIGBUS', 7);
define('SIGFPE', 8);
define('SIGKILL', 9);
define('SIGUSR1', 10);
define('SIGSEGV', 11);
define('SIGUSR2', 12);
define('SIGPIPE', 13);
define('SIGALRM', 14);
define('SIGTERM', 15);
define('SIGSTKFLT', 16);
define('SIGCLD', 17);
define('SIGCHLD', 17);
define('SIGCONT', 18);
define('SIGSTOP', 19);
define('SIGTSTP', 20);
define('SIGTTIN', 21);
define('SIGTTOU', 22);
define('SIGURG', 23);
define('SIGXCPU', 24);
define('SIGXFSZ', 25);
define('SIGVTALRM', 26);
define('SIGPROF', 27);
define('SIGWINCH', 28);
define('SIGPOLL', 29);
define('SIGIO', 29);
define('SIGPWR', 30);
define('SIGSYS', 31);
define('SIGBABY', 31);
define('PRIO_PGRP', 1);
define('PRIO_USER', 2);
define('PRIO_PROCESS', 0);


+ 2
- 2
composer.json View File

"cs:fix": "php-cs-fixer fix", "cs:fix": "php-cs-fixer fix",
"cs:check": "php-cs-fixer fix --dry-run --diff", "cs:check": "php-cs-fixer fix --dry-run --diff",
"lint": "find . -name \\*.php -not -path './lib/composer/*' -not -path './build/stubs/*' -print0 | xargs -0 -n1 php -l", "lint": "find . -name \\*.php -not -path './lib/composer/*' -not -path './build/stubs/*' -print0 | xargs -0 -n1 php -l",
"psalm": "psalm",
"psalm:update-baseline": "psalm --update-baseline --set-baseline=build/psalm-baseline.xml"
"psalm": "psalm --threads=1",
"psalm:update-baseline": "psalm --threads=1 --update-baseline --set-baseline=build/psalm-baseline.xml"
} }
} }

+ 1
- 1
core/Command/App/GetPath.php View File

* *
* @param InputInterface $input An InputInterface instance * @param InputInterface $input An InputInterface instance
* @param OutputInterface $output An OutputInterface instance * @param OutputInterface $output An OutputInterface instance
* @return null|int null or 0 if everything went fine, or an error code
* @return int 0 if everything went fine, or an error code
*/ */
protected function execute(InputInterface $input, OutputInterface $output): int { protected function execute(InputInterface $input, OutputInterface $output): int {
$appName = $input->getArgument('app'); $appName = $input->getArgument('app');

+ 1
- 1
core/Command/Config/App/GetConfig.php View File

* *
* @param InputInterface $input An InputInterface instance * @param InputInterface $input An InputInterface instance
* @param OutputInterface $output An OutputInterface instance * @param OutputInterface $output An OutputInterface instance
* @return null|int null or 0 if everything went fine, or an error code
* @return int 0 if everything went fine, or an error code
*/ */
protected function execute(InputInterface $input, OutputInterface $output): int { protected function execute(InputInterface $input, OutputInterface $output): int {
$appName = $input->getArgument('app'); $appName = $input->getArgument('app');

+ 2
- 2
core/Command/Config/System/GetConfig.php View File

* *
* @param InputInterface $input An InputInterface instance * @param InputInterface $input An InputInterface instance
* @param OutputInterface $output An OutputInterface instance * @param OutputInterface $output An OutputInterface instance
* @return null|int null or 0 if everything went fine, or an error code
* @return int 0 if everything went fine, or an error code
*/ */
protected function execute(InputInterface $input, OutputInterface $output): int {
protected function execute(InputInterface $input, OutputInterface $output) {
$configNames = $input->getArgument('name'); $configNames = $input->getArgument('name');
$configName = array_shift($configNames); $configName = array_shift($configNames);
$defaultValue = $input->getOption('default-value'); $defaultValue = $input->getOption('default-value');

+ 2
- 2
lib/composer/composer/installed.php View File

'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../../../', 'install_path' => __DIR__ . '/../../../',
'aliases' => array(), 'aliases' => array(),
'reference' => '63a9bc2aacf829563ac74abe29d4edf6ff31b8b1',
'reference' => '1225189f74d06606aafc4150d07584b90cea50dd',
'name' => '__root__', 'name' => '__root__',
'dev' => false, 'dev' => false,
), ),
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../../../', 'install_path' => __DIR__ . '/../../../',
'aliases' => array(), 'aliases' => array(),
'reference' => '63a9bc2aacf829563ac74abe29d4edf6ff31b8b1',
'reference' => '1225189f74d06606aafc4150d07584b90cea50dd',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
), ),

+ 1
- 1
lib/private/Collaboration/Resources/Manager.php View File

*/ */
public function searchCollections(IUser $user, string $filter, int $limit = 50, int $start = 0): array { public function searchCollections(IUser $user, string $filter, int $limit = 50, int $start = 0): array {
$query = $this->connection->getQueryBuilder(); $query = $this->connection->getQueryBuilder();
$userId = $user instanceof IUser ? $user->getUID() : '';
$userId = $user->getUID();


$query->select('c.*', 'a.access') $query->select('c.*', 'a.access')
->from(self::TABLE_COLLECTIONS, 'c') ->from(self::TABLE_COLLECTIONS, 'c')

+ 1
- 1
lib/private/Files/View.php View File

} }
$info = new FileInfo($path, $storage, $internalPath, $data, $mount, $owner); $info = new FileInfo($path, $storage, $internalPath, $data, $mount, $owner);


if ($data and isset($data['fileid'])) {
if (isset($data['fileid'])) {
if ($includeMountPoints and $data['mimetype'] === 'httpd/unix-directory') { if ($includeMountPoints and $data['mimetype'] === 'httpd/unix-directory') {
//add the sizes of other mount points to the folder //add the sizes of other mount points to the folder
$extOnly = ($includeMountPoints === 'ext'); $extOnly = ($includeMountPoints === 'ext');

+ 61
- 72
lib/private/Installer.php View File

$extractDir = $this->tempManager->getTemporaryFolder(); $extractDir = $this->tempManager->getTemporaryFolder();
$archive = new TAR($tempFile); $archive = new TAR($tempFile);


if ($archive) {
if (!$archive->extract($extractDir)) {
$errorMessage = 'Could not extract app ' . $appId;
if (!$archive->extract($extractDir)) {
$errorMessage = 'Could not extract app ' . $appId;


$archiveError = $archive->getError();
if ($archiveError instanceof \PEAR_Error) {
$errorMessage .= ': ' . $archiveError->getMessage();
}

throw new \Exception($errorMessage);
}
$allFiles = scandir($extractDir);
$folders = array_diff($allFiles, ['.', '..']);
$folders = array_values($folders);

if (count($folders) > 1) {
throw new \Exception(
sprintf(
'Extracted app %s has more than 1 folder',
$appId
)
);
$archiveError = $archive->getError();
if ($archiveError instanceof \PEAR_Error) {
$errorMessage .= ': ' . $archiveError->getMessage();
} }


// Check if appinfo/info.xml has the same app ID as well
if ((PHP_VERSION_ID < 80000)) {
$loadEntities = libxml_disable_entity_loader(false);
$xml = simplexml_load_file($extractDir . '/' . $folders[0] . '/appinfo/info.xml');
libxml_disable_entity_loader($loadEntities);
} else {
$xml = simplexml_load_file($extractDir . '/' . $folders[0] . '/appinfo/info.xml');
}
if ((string)$xml->id !== $appId) {
throw new \Exception(
sprintf(
'App for id %s has a wrong app ID in info.xml: %s',
$appId,
(string)$xml->id
)
);
}
throw new \Exception($errorMessage);
}
$allFiles = scandir($extractDir);
$folders = array_diff($allFiles, ['.', '..']);
$folders = array_values($folders);


// Check if the version is lower than before
$currentVersion = OC_App::getAppVersion($appId);
$newVersion = (string)$xml->version;
if (version_compare($currentVersion, $newVersion) === 1) {
throw new \Exception(
sprintf(
'App for id %s has version %s and tried to update to lower version %s',
$appId,
$currentVersion,
$newVersion
)
);
}
if (count($folders) > 1) {
throw new \Exception(
sprintf(
'Extracted app %s has more than 1 folder',
$appId
)
);
}


$baseDir = OC_App::getInstallPath() . '/' . $appId;
// Remove old app with the ID if existent
OC_Helper::rmdirr($baseDir);
// Move to app folder
if (@mkdir($baseDir)) {
$extractDir .= '/' . $folders[0];
OC_Helper::copyr($extractDir, $baseDir);
}
OC_Helper::copyr($extractDir, $baseDir);
OC_Helper::rmdirr($extractDir);
return;
// Check if appinfo/info.xml has the same app ID as well
if ((PHP_VERSION_ID < 80000)) {
$loadEntities = libxml_disable_entity_loader(false);
$xml = simplexml_load_file($extractDir . '/' . $folders[0] . '/appinfo/info.xml');
libxml_disable_entity_loader($loadEntities);
} else { } else {
$xml = simplexml_load_file($extractDir . '/' . $folders[0] . '/appinfo/info.xml');
}
if ((string)$xml->id !== $appId) {
throw new \Exception( throw new \Exception(
sprintf( sprintf(
'Could not extract app with ID %s to %s',
'App for id %s has a wrong app ID in info.xml: %s',
$appId, $appId,
$extractDir
(string)$xml->id
) )
); );
} }
} else {
// Signature does not match
throw new \Exception(
sprintf(
'App with id %s has invalid signature',
$appId
)
);

// Check if the version is lower than before
$currentVersion = OC_App::getAppVersion($appId);
$newVersion = (string)$xml->version;
if (version_compare($currentVersion, $newVersion) === 1) {
throw new \Exception(
sprintf(
'App for id %s has version %s and tried to update to lower version %s',
$appId,
$currentVersion,
$newVersion
)
);
}

$baseDir = OC_App::getInstallPath() . '/' . $appId;
// Remove old app with the ID if existent
OC_Helper::rmdirr($baseDir);
// Move to app folder
if (@mkdir($baseDir)) {
$extractDir .= '/' . $folders[0];
OC_Helper::copyr($extractDir, $baseDir);
}
OC_Helper::copyr($extractDir, $baseDir);
OC_Helper::rmdirr($extractDir);
return;
} }
// Signature does not match
throw new \Exception(
sprintf(
'App with id %s has invalid signature',
$appId
)
);
} }
} }



+ 1
- 0
lib/private/Memcache/Memcached.php View File

//\Memcached::OPT_BINARY_PROTOCOL => true, //\Memcached::OPT_BINARY_PROTOCOL => true,
]; ];
// by default enable igbinary serializer if available // by default enable igbinary serializer if available
/** @psalm-suppress RedundantCondition */
if (\Memcached::HAVE_IGBINARY) { if (\Memcached::HAVE_IGBINARY) {
$defaultOptions[\Memcached::OPT_SERIALIZER] = $defaultOptions[\Memcached::OPT_SERIALIZER] =
\Memcached::SERIALIZER_IGBINARY; \Memcached::SERIALIZER_IGBINARY;

+ 2
- 2
lib/private/Notification/Manager.php View File

throw new \InvalidArgumentException('The given notification has been processed'); throw new \InvalidArgumentException('The given notification has been processed');
} }


if (!($notification instanceof INotification) || !$notification->isValidParsed()) {
if (!$notification->isValidParsed()) {
throw new \InvalidArgumentException('The given notification has not been handled'); throw new \InvalidArgumentException('The given notification has not been handled');
} }
} }


if (!($notification instanceof INotification) || !$notification->isValidParsed()) {
if (!$notification->isValidParsed()) {
throw new \InvalidArgumentException('The given notification has not been handled'); throw new \InvalidArgumentException('The given notification has not been handled');
} }



+ 4
- 0
psalm-ocp.xml View File

<directory name="lib/composer/bin"/> <directory name="lib/composer/bin"/>
</ignoreFiles> </ignoreFiles>
</projectFiles> </projectFiles>
<stubs>
<file name="build/stubs/gd.php"/>
<file name="build/stubs/ldap.php"/>
</stubs>
<extraFiles> <extraFiles>
<directory name="3rdparty"/> <directory name="3rdparty"/>
</extraFiles> </extraFiles>

+ 2
- 7
psalm.xml View File

<file name="build/stubs/sftp.php"/> <file name="build/stubs/sftp.php"/>
<file name="build/stubs/ssh2.php"/> <file name="build/stubs/ssh2.php"/>
<file name="build/stubs/xsl.php"/> <file name="build/stubs/xsl.php"/>
<file name="build/stubs/ftp.php"/>
<file name="build/stubs/pcntl.php"/>
</stubs> </stubs>
<issueHandlers> <issueHandlers>
<UndefinedClass> <UndefinedClass>
<errorLevel type="suppress"> <errorLevel type="suppress">
<referencedClass name="OCA\GroupFolders\Mount\GroupFolderStorage"/> <referencedClass name="OCA\GroupFolders\Mount\GroupFolderStorage"/>
<referencedClass name="OCA\TwoFactorNextcloudNotification\Controller\APIController"/> <referencedClass name="OCA\TwoFactorNextcloudNotification\Controller\APIController"/>
<!-- Classes from PHP>=8 (needed to be able to use \GdImage::class) -->
<referencedClass name="GdImage" />
</errorLevel> </errorLevel>
</UndefinedClass> </UndefinedClass>
<UndefinedFunction> <UndefinedFunction>
<!-- Helper classes for sharing API integration from other apps --> <!-- Helper classes for sharing API integration from other apps -->
<referencedClass name="OCA\Deck\Sharing\ShareAPIHelper" /> <referencedClass name="OCA\Deck\Sharing\ShareAPIHelper" />
<referencedClass name="OCA\Talk\Share\Helper\DeletedShareAPIController" /> <referencedClass name="OCA\Talk\Share\Helper\DeletedShareAPIController" />
<!-- Classes from PHP>=8 -->
<referencedClass name="GdImage" />
<referencedClass name="LDAP\Connection" />
<referencedClass name="LDAP\Result" />
<referencedClass name="LDAP\ResultEntry" />
</errorLevel> </errorLevel>
</UndefinedDocblockClass> </UndefinedDocblockClass>
</issueHandlers> </issueHandlers>

+ 4
- 2
vendor-bin/psalm/composer.json View File

{ {
"require": { "require": {
"nikic/php-parser": "^4.13",
"vimeo/psalm": "^4.17"
"vimeo/psalm": "^4.18"
}, },
"config": { "config": {
"platform": {
"php": "7.3"
},
"allow-plugins": { "allow-plugins": {
"composer/package-versions-deprecated": true "composer/package-versions-deprecated": true
} }

+ 17
- 14
vendor-bin/psalm/composer.lock View File

"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "a27ae1441b036754d39358d5dde4905b",
"content-hash": "c3c578c654631288a179470ece96f0ba",
"packages": [ "packages": [
{ {
"name": "amphp/amp", "name": "amphp/amp",
}, },
{ {
"name": "psr/container", "name": "psr/container",
"version": "1.1.2",
"version": "1.1.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/php-fig/container.git", "url": "https://github.com/php-fig/container.git",
"reference": "513e0666f7216c7459170d56df27dfcefe1689ea"
"reference": "8622567409010282b7aeebe4bb841fe98b58dcaf"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/php-fig/container/zipball/513e0666f7216c7459170d56df27dfcefe1689ea",
"reference": "513e0666f7216c7459170d56df27dfcefe1689ea",
"url": "https://api.github.com/repos/php-fig/container/zipball/8622567409010282b7aeebe4bb841fe98b58dcaf",
"reference": "8622567409010282b7aeebe4bb841fe98b58dcaf",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=7.4.0"
"php": ">=7.2.0"
}, },
"type": "library", "type": "library",
"autoload": { "autoload": {
], ],
"support": { "support": {
"issues": "https://github.com/php-fig/container/issues", "issues": "https://github.com/php-fig/container/issues",
"source": "https://github.com/php-fig/container/tree/1.1.2"
"source": "https://github.com/php-fig/container/tree/1.1.1"
}, },
"time": "2021-11-05T16:50:12+00:00"
"time": "2021-03-05T17:36:06+00:00"
}, },
{ {
"name": "psr/log", "name": "psr/log",
}, },
{ {
"name": "vimeo/psalm", "name": "vimeo/psalm",
"version": "4.17.0",
"version": "4.18.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/vimeo/psalm.git", "url": "https://github.com/vimeo/psalm.git",
"reference": "6f4707aa41c9174353a6434bba3fc8840f981d9c"
"reference": "dda05fa913f4dc6eb3386f2f7ce5a45d37a71bcb"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/vimeo/psalm/zipball/6f4707aa41c9174353a6434bba3fc8840f981d9c",
"reference": "6f4707aa41c9174353a6434bba3fc8840f981d9c",
"url": "https://api.github.com/repos/vimeo/psalm/zipball/dda05fa913f4dc6eb3386f2f7ce5a45d37a71bcb",
"reference": "dda05fa913f4dc6eb3386f2f7ce5a45d37a71bcb",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
], ],
"support": { "support": {
"issues": "https://github.com/vimeo/psalm/issues", "issues": "https://github.com/vimeo/psalm/issues",
"source": "https://github.com/vimeo/psalm/tree/4.17.0"
"source": "https://github.com/vimeo/psalm/tree/4.18.1"
}, },
"time": "2022-01-01T18:39:47+00:00"
"time": "2022-01-08T21:21:26+00:00"
}, },
{ {
"name": "webmozart/assert", "name": "webmozart/assert",
"prefer-lowest": false, "prefer-lowest": false,
"platform": [], "platform": [],
"platform-dev": [], "platform-dev": [],
"platform-overrides": {
"php": "7.3"
},
"plugin-api-version": "2.2.0" "plugin-api-version": "2.2.0"
} }

Loading…
Cancel
Save