diff --git a/.drone.star b/.drone.star index 34daff243d57..3a824b0bcb5f 100644 --- a/.drone.star +++ b/.drone.star @@ -26,7 +26,7 @@ SONARSOURCE_SONAR_SCANNER_CLI = "sonarsource/sonar-scanner-cli:5" TOOLHIPPIE_CALENS = "toolhippie/calens:latest" WEBHIPPIE_REDIS = "webhippie/redis:latest" -DEFAULT_PHP_VERSION = "7.4" +DEFAULT_PHP_VERSION = "8.3" DEFAULT_NODEJS_VERSION = "14" # minio mc environment variables @@ -85,18 +85,6 @@ config = { "oracle", ], }, - "ubuntu22": { - "phpVersions": [ - "7.4-ubuntu22.04", - ], - # These pipelines are run just to help avoid any obscure regression - # on Ubuntu 22.04. We do not need coverage for this. - "coverage": False, - "databases": [ - "mariadb:10.6", - "mariadb:10.11", - ], - }, "external-samba": { "phpVersions": [ DEFAULT_PHP_VERSION, @@ -251,10 +239,6 @@ config = { "testingRemoteSystem": False, }, "cliEncryption": { - "phpVersions": [ - DEFAULT_PHP_VERSION, - "7.4-ubuntu22.04", - ], "suites": [ "cliEncryption", ], @@ -420,18 +404,6 @@ config = { "runAllSuites": True, "numberOfParts": 8, }, - "apiUbuntu22": { - "phpVersions": [ - "7.4-ubuntu22.04", - ], - "suites": { - "apiUbuntu22": "apiUbuntu22", - }, - "useHttps": False, - "filterTags": "@smokeTest&&~@notifications-app-required&&~@local_storage&&~@files_external-app-required", - "runAllSuites": True, - "numberOfParts": 8, - }, "apiOnSqlite": { "suites": { "apiOnSqlite": "apiOnSqlite", @@ -1153,15 +1125,18 @@ def phpTests(ctx, testType, withCoverage): else: command = "unknown tbd" - # Shorten PHP docker tags that have longer names like 7.4-ubuntu22.04 - phpVersionString = phpVersion.replace("-ubuntu", "-u") + # Get the first 3 characters of the PHP version (7.4 or 8.0 etc) + # And use that for constructing the pipeline name + # That helps shorten pipeline names when using owncloud-ci images + # that have longer names like 7.4-ubuntu20.04 + phpMinorVersion = phpVersion[0:3] for db in params["databases"]: for externalType in params["externalTypes"]: keyString = "-" + category if params["includeKeyInMatrixName"] else "" filesExternalType = externalType if externalType != "none" else "" externalNameString = "-" + externalType if externalType != "none" else "" - name = "%s%s-php%s-%s%s" % (testType, keyString, phpVersionString, getShortDbNameAndVersion(db), externalNameString) + name = "%s%s-php%s-%s%s" % (testType, keyString, phpMinorVersion, getShortDbNameAndVersion(db), externalNameString) maxLength = 50 nameLength = len(name) if nameLength > maxLength: @@ -1426,8 +1401,11 @@ def acceptance(ctx): for federatedServerVersion in params["federatedServerVersions"]: for browser in params["browsers"]: for phpVersion in params["phpVersions"]: - # Shorten PHP docker tags that have longer names like 7.4-ubuntu22.04 - phpVersionString = phpVersion.replace("-ubuntu", "-u") + # Get the first 3 characters of the PHP version (7.4 or 8.0 etc) + # And use that for constructing the pipeline name + # That helps shorten pipeline names when using owncloud-ci images + # that have longer names like 7.4-ubuntu20.04 + phpMinorVersion = phpVersion[0:3] for db in params["databases"]: for runPart in range(1, params["numberOfParts"] + 1): debugPartsEnabled = (len(params["skipExceptParts"]) != 0) @@ -1449,7 +1427,7 @@ def acceptance(ctx): keyString = "-" + category if params["includeKeyInMatrixName"] else "" partString = "" if params["numberOfParts"] == 1 else "-%d-%d" % (params["numberOfParts"], runPart) federatedServerVersionString = "-" + federatedServerVersion.replace("daily-", "").replace("-qa", "") if (federatedServerVersion != "") else "" - name = "%s%s%s%s%s-%s-php%s" % (alternateSuiteName, keyString, partString, federatedServerVersionString, browserString, getShortDbNameAndVersion(db), phpVersionString) + name = "%s%s%s%s%s-%s-php%s" % (alternateSuiteName, keyString, partString, federatedServerVersionString, browserString, getShortDbNameAndVersion(db), phpMinorVersion) maxLength = 50 nameLength = len(name) if nameLength > maxLength: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 54dc8b108015..d45250bef066 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,4 +26,4 @@ jobs: name: PHP Unit uses: ./.github/workflows/php-unit.yml with: - php-versions: '["7.4"]' + php-versions: '["8.3"]' diff --git a/.github/workflows/lint-and-codestyle.yml b/.github/workflows/lint-and-codestyle.yml index a9639e08ffe3..b5f820141815 100644 --- a/.github/workflows/lint-and-codestyle.yml +++ b/.github/workflows/lint-and-codestyle.yml @@ -24,7 +24,7 @@ jobs: strategy: fail-fast: false matrix: - php-version: ["7.4"] + php-version: ["8.3"] steps: - name: Checkout code uses: actions/checkout@v4 diff --git a/.github/workflows/php-unit.yml b/.github/workflows/php-unit.yml index 38f51a2f0693..bef5b42dd716 100644 --- a/.github/workflows/php-unit.yml +++ b/.github/workflows/php-unit.yml @@ -19,9 +19,9 @@ jobs: php: ${{ fromJSON(inputs.php-versions) }} database: [sqlite] include: - - php: "7.4" + - php: "8.3" database: "mysql:8.0" - - php: "7.4" + - php: "8.3" database: "postgres:10.21" services: diff --git a/apps/dav/lib/CalDAV/Schedule/IMipPlugin.php b/apps/dav/lib/CalDAV/Schedule/IMipPlugin.php index ffe6930fdb4a..4fcbc95e535e 100644 --- a/apps/dav/lib/CalDAV/Schedule/IMipPlugin.php +++ b/apps/dav/lib/CalDAV/Schedule/IMipPlugin.php @@ -41,21 +41,12 @@ * @license http://sabre.io/license/ Modified BSD License */ class IMipPlugin extends SabreIMipPlugin { - /** @var IMailer */ - private $mailer; - - /** @var ILogger */ - private $logger; - - /** @var IRequest */ - private $request; + private IMailer $mailer; + private ILogger $logger; + private IRequest $request; /** * Creates the email handler. - * - * @param IMailer $mailer - * @param ILogger $logger - * @param IRequest $request */ public function __construct(IMailer $mailer, ILogger $logger, IRequest $request) { parent::__construct(''); @@ -123,14 +114,10 @@ public function schedule(ITip\Message $iTipMessage) { ->setFrom([$sender => $senderName]) ->setTo([$recipient => $recipientName]) ->setSubject($subject) - ->setBody($iTipMessage->message->serialize(), $contentType); + ->attach($iTipMessage->message->serialize(), "event.ics", $contentType); try { - $failed = $this->mailer->send($message); + $this->mailer->send($message); $iTipMessage->scheduleStatus = '1.1; Scheduling message is sent via iMip'; - if ($failed) { - $this->logger->error('Unable to deliver message to {failed}', ['app' => 'dav', 'failed' => \implode(', ', $failed)]); - $iTipMessage->scheduleStatus = '5.0; EMail delivery failed'; - } } catch (\Exception $ex) { $this->logger->logException($ex, ['app' => 'dav']); $iTipMessage->scheduleStatus = '5.0; EMail delivery failed'; diff --git a/apps/dav/lib/Connector/Sabre/Principal.php b/apps/dav/lib/Connector/Sabre/Principal.php index c9022719a894..4942052e8103 100644 --- a/apps/dav/lib/Connector/Sabre/Principal.php +++ b/apps/dav/lib/Connector/Sabre/Principal.php @@ -97,10 +97,10 @@ public function getPrincipalsByPrefix($prefixPath) { * getPrincipalsByPrefix. * * @param string $path - * @return array + * @return array|null */ - public function getPrincipalByPath($path) { - list($prefix, $name) = \Sabre\Uri\split($path); + public function getPrincipalByPath($path): ?array { + [$prefix, $name] = \Sabre\Uri\split($path); if ($prefix === $this->principalPrefix) { $user = $this->userManager->get($name); @@ -219,12 +219,12 @@ public function findByUri($uri, $principalPrefix) { * @param IUser $user * @return array */ - protected function userToPrincipal($user) { + protected function userToPrincipal(IUser $user): array { $userId = $user->getUID(); $displayName = $user->getDisplayName(); $principal = [ 'uri' => $this->principalPrefix . '/' . $userId, - '{DAV:}displayname' => $displayName === null ? $userId : $displayName, + '{DAV:}displayname' => $displayName, ]; $email = $user->getEMailAddress(); diff --git a/apps/dav/lib/Server.php b/apps/dav/lib/Server.php index 338be6e7816c..c4e5315a00df 100644 --- a/apps/dav/lib/Server.php +++ b/apps/dav/lib/Server.php @@ -179,7 +179,6 @@ public function __construct(IRequest $request, $baseUri) { $acl->principalCollectionSet = [ 'principals/users', 'principals/groups' ]; - $acl->defaultUsernamePath = 'principals/users'; $this->server->addPlugin($acl); } diff --git a/apps/dav/lib/Upload/AssemblyStream.php b/apps/dav/lib/Upload/AssemblyStream.php index 2f408f5b876a..da32e15b113d 100644 --- a/apps/dav/lib/Upload/AssemblyStream.php +++ b/apps/dav/lib/Upload/AssemblyStream.php @@ -248,9 +248,12 @@ public static function wrap(array $nodes) { 'assembly' => [ 'nodes' => $nodes] ]); - \stream_wrapper_register('assembly', '\OCA\DAV\Upload\AssemblyStream'); + $existed = \in_array("assembly", stream_get_wrappers()); + if (!$existed) { + \stream_wrapper_register('assembly', __CLASS__); + } try { - $wrapped = \fopen('assembly://', 'r', null, $context); + $wrapped = \fopen('assembly://', 'r', false, $context); } catch (\BadMethodCallException $e) { \stream_wrapper_unregister('assembly'); throw $e; diff --git a/apps/dav/tests/unit/CalDAV/CalendarTest.php b/apps/dav/tests/unit/CalDAV/CalendarTest.php index 4cdbfe8a517f..a5042f271840 100644 --- a/apps/dav/tests/unit/CalDAV/CalendarTest.php +++ b/apps/dav/tests/unit/CalDAV/CalendarTest.php @@ -42,9 +42,9 @@ public function setUp(): void { $this->l10n ->expects($this->any()) ->method('t') - ->will($this->returnCallback(function ($text, $parameters = []) { + ->willReturnCallback(function ($text, $parameters = []) { return \vsprintf($text, $parameters); - })); + }); } public function testDelete() { diff --git a/apps/dav/tests/unit/CalDAV/Schedule/IMipPluginTest.php b/apps/dav/tests/unit/CalDAV/Schedule/IMipPluginTest.php index c1902456caab..534cd97253e0 100644 --- a/apps/dav/tests/unit/CalDAV/Schedule/IMipPluginTest.php +++ b/apps/dav/tests/unit/CalDAV/Schedule/IMipPluginTest.php @@ -22,124 +22,78 @@ namespace OCA\DAV\Tests\unit\CalDAV\Schedule; +use Exception; use OC\Mail\Mailer; use OCA\DAV\CalDAV\Schedule\IMipPlugin; use OCP\ILogger; use OCP\IRequest; +use PHPUnit\Framework\MockObject\MockObject; use Sabre\VObject\Component\VCalendar; use Sabre\VObject\ITip\Message; +use Symfony\Component\Mime\Email; use Test\TestCase; use OC\Log; class IMipPluginTest extends TestCase { - public function testDelivery() { - $mailMessage = new \OC\Mail\Message(new \Swift_Message()); - /** @var Mailer | \PHPUnit\Framework\MockObject\MockObject $mailer */ - $mailer = $this->createMock(Mailer::class); - $mailer->method('createMessage')->willReturn($mailMessage); - $mailer->expects($this->once())->method('send'); - /** @var ILogger | \PHPUnit\Framework\MockObject\MockObject $logger */ - $logger = $this->createMock(Log::class); - /** @var IRequest| \PHPUnit\Framework\MockObject\MockObject $request */ + private \OC\Mail\Message $mailMessage; + /** + * @var Mailer|MockObject + */ + private $mailer; + private IMipPlugin $plugin; + /** @var ILogger|MockObject */ + private $logger; + + protected function setUp(): void { + parent::setUp(); + + $this->mailMessage = new \OC\Mail\Message(new Email()); + $this->mailer = $this->createMock(Mailer::class); + $this->mailer->method('createMessage')->willReturn($this->mailMessage); + + $this->logger = $this->createMock(Log::class); + /** @var IRequest| MockObject $request */ $request = $this->createMock(IRequest::class); - $plugin = new IMipPlugin($mailer, $logger, $request); - $message = new Message(); - $message->method = 'REQUEST'; - $message->message = new VCalendar(); - $message->message->add('VEVENT', [ - 'UID' => $message->uid, - 'SEQUENCE' => $message->sequence, - 'SUMMARY' => 'Fellowship meeting', - ]); - $message->sender = 'mailto:gandalf@wiz.ard'; - $message->recipient = 'mailto:frodo@hobb.it'; + $this->plugin = new IMipPlugin($this->mailer, $this->logger, $request); + } + + public function testDelivery(): void { + $this->mailer->expects($this->once())->method('send'); + + $message = $this->buildIMIPMessage('REQUEST'); - $plugin->schedule($message); + $this->plugin->schedule($message); $this->assertEquals('1.1', $message->getScheduleStatus()); - $this->assertEquals('Fellowship meeting', $mailMessage->getSubject()); - $this->assertEquals(['frodo@hobb.it' => null], $mailMessage->getTo()); - $this->assertEquals(['gandalf@wiz.ard' => null], $mailMessage->getReplyTo()); - $this->assertEquals('text/calendar; charset=UTF-8; method=REQUEST', $mailMessage->getSwiftMessage()->getContentType()); + $this->assertEquals('Fellowship meeting', $this->mailMessage->getSubject()); + $this->assertEquals(['frodo@hobb.it' => null], $this->mailMessage->getTo()); + $this->assertEquals(['gandalf@wiz.ard' => null], $this->mailMessage->getReplyTo()); + $this->assertStringContainsString('text/calendar; charset=UTF-8; method=REQUEST', $this->mailMessage->getMessage()->getBody()->bodyToString()); } - public function testFailedDeliveryWithException() { - $mailMessage = new \OC\Mail\Message(new \Swift_Message()); - /** @var Mailer | \PHPUnit\Framework\MockObject\MockObject $mailer */ - $mailer = $this->createMock(Mailer::class); - $mailer->method('createMessage')->willReturn($mailMessage); - $mailer->method('send')->willThrowException(new \Exception()); - /** @var ILogger | \PHPUnit\Framework\MockObject\MockObject $logger */ - $logger = $this->createMock(Log::class); - /** @var IRequest| \PHPUnit\Framework\MockObject\MockObject $request */ - $request = $this->createMock(IRequest::class); + public function testFailedDeliveryWithException(): void { + $ex = new Exception(); + $this->mailer->method('send')->willThrowException($ex); + $this->logger->expects(self::once())->method('logException')->with($ex, ['app' => 'dav']); - $plugin = new IMipPlugin($mailer, $logger, $request); - $message = new Message(); - $message->method = 'REQUEST'; - $message->message = new VCalendar(); - $message->message->add('VEVENT', [ - 'UID' => $message->uid, - 'SEQUENCE' => $message->sequence, - 'SUMMARY' => 'Fellowship meeting', - ]); - $message->sender = 'mailto:gandalf@wiz.ard'; - $message->recipient = 'mailto:frodo@hobb.it'; + $message = $this->buildIMIPMessage('REQUEST'); - $plugin->schedule($message); - $this->assertEquals('5.0', $message->getScheduleStatus()); - $this->assertEquals('Fellowship meeting', $mailMessage->getSubject()); - $this->assertEquals(['frodo@hobb.it' => null], $mailMessage->getTo()); - $this->assertEquals(['gandalf@wiz.ard' => null], $mailMessage->getReplyTo()); - $this->assertEquals('text/calendar; charset=UTF-8; method=REQUEST', $mailMessage->getSwiftMessage()->getContentType()); + $this->plugin->schedule($message); + $this->assertIMipState($message, '5.0', 'REQUEST', 'Fellowship meeting'); } - public function testFailedDelivery() { - $mailMessage = new \OC\Mail\Message(new \Swift_Message()); - /** @var Mailer | \PHPUnit\Framework\MockObject\MockObject $mailer */ - $mailer = $this->createMock(Mailer::class); - $mailer->method('createMessage')->willReturn($mailMessage); - $mailer->method('send')->willReturn(['foo@example.net']); - /** @var ILogger | \PHPUnit\Framework\MockObject\MockObject $logger */ - $logger = $this->createMock(Log::class); - $logger->expects(self::once())->method('error')->with('Unable to deliver message to {failed}', ['app' => 'dav', 'failed' => 'foo@example.net']); - /** @var IRequest| \PHPUnit\Framework\MockObject\MockObject $request */ - $request = $this->createMock(IRequest::class); + public function testDeliveryOfCancel(): void { + $this->mailer->expects($this->once())->method('send'); - $plugin = new IMipPlugin($mailer, $logger, $request); - $message = new Message(); - $message->method = 'REQUEST'; - $message->message = new VCalendar(); - $message->message->add('VEVENT', [ - 'UID' => $message->uid, - 'SEQUENCE' => $message->sequence, - 'SUMMARY' => 'Fellowship meeting', - ]); - $message->sender = 'mailto:gandalf@wiz.ard'; - $message->recipient = 'mailto:frodo@hobb.it'; + $message = $this->buildIMIPMessage('CANCEL'); - $plugin->schedule($message); - $this->assertEquals('5.0', $message->getScheduleStatus()); - $this->assertEquals('Fellowship meeting', $mailMessage->getSubject()); - $this->assertEquals(['frodo@hobb.it' => null], $mailMessage->getTo()); - $this->assertEquals(['gandalf@wiz.ard' => null], $mailMessage->getReplyTo()); - $this->assertEquals('text/calendar; charset=UTF-8; method=REQUEST', $mailMessage->getSwiftMessage()->getContentType()); + $this->plugin->schedule($message); + $this->assertIMipState($message, '1.1', 'CANCEL', 'Cancelled: Fellowship meeting'); } - public function testDeliveryOfCancel() { - $mailMessage = new \OC\Mail\Message(new \Swift_Message()); - /** @var Mailer | \PHPUnit\Framework\MockObject\MockObject $mailer */ - $mailer = $this->createMock(Mailer::class); - $mailer->method('createMessage')->willReturn($mailMessage); - $mailer->expects($this->once())->method('send'); - /** @var ILogger | \PHPUnit\Framework\MockObject\MockObject $logger */ - $logger = $this->createMock(Log::class); - /** @var IRequest| \PHPUnit\Framework\MockObject\MockObject $request */ - $request = $this->createMock(IRequest::class); - - $plugin = new IMipPlugin($mailer, $logger, $request); + private function buildIMIPMessage(string $method): Message { $message = new Message(); - $message->method = 'CANCEL'; + $message->method = $method; $message->message = new VCalendar(); $message->message->add('VEVENT', [ 'UID' => $message->uid, @@ -148,13 +102,14 @@ public function testDeliveryOfCancel() { ]); $message->sender = 'mailto:gandalf@wiz.ard'; $message->recipient = 'mailto:frodo@hobb.it'; + return $message; + } - $plugin->schedule($message); - $this->assertEquals('1.1', $message->getScheduleStatus()); - $this->assertEquals('Cancelled: Fellowship meeting', $mailMessage->getSubject()); - $this->assertEquals(['frodo@hobb.it' => null], $mailMessage->getTo()); - $this->assertEquals(['gandalf@wiz.ard' => null], $mailMessage->getReplyTo()); - $this->assertEquals('text/calendar; charset=UTF-8; method=CANCEL', $mailMessage->getSwiftMessage()->getContentType()); - $this->assertEquals('CANCELLED', $message->message->VEVENT->STATUS->getValue()); + private function assertIMipState(Message $message, string $scheduleStatus, string $method, string $mailSubject): void { + $this->assertEquals($scheduleStatus, $message->getScheduleStatus()); + $this->assertEquals($mailSubject, $this->mailMessage->getSubject()); + $this->assertEquals(['frodo@hobb.it' => null], $this->mailMessage->getTo()); + $this->assertEquals(['gandalf@wiz.ard' => null], $this->mailMessage->getReplyTo()); + $this->assertStringContainsString("text/calendar; charset=UTF-8; method=$method", $this->mailMessage->getMessage()->getBody()->bodyToString()); } } diff --git a/apps/dav/tests/unit/Connector/Sabre/FileTest.php b/apps/dav/tests/unit/Connector/Sabre/FileTest.php index 20c7ec8cb72a..29c9d923201e 100644 --- a/apps/dav/tests/unit/Connector/Sabre/FileTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/FileTest.php @@ -262,13 +262,12 @@ public function testFileContentNotAllowedConvertedToForbidden() { ->getMock(); $view->expects($this->atLeastOnce()) ->method('resolvePath') - ->will( - $this->returnCallback( - function ($path) use ($storage) { - return [$storage, $path]; - } - ) + ->willReturnCallback( + function ($path) use ($storage) { + return [$storage, $path]; + } ); + $view->method('getRelativePath')->willReturn('test.txt'); $storage->expects($this->once()) ->method('fopen') @@ -349,11 +348,11 @@ public function testChunkedPutFails($thrownException, $expectedException, $check $view = $this->createMock(View::class, ['getRelativePath', 'resolvePath'], []); $view->expects($this->atLeastOnce()) ->method('resolvePath') - ->will($this->returnCallback( - function ($path) use ($storage) { - return [$storage, $path]; - } - )); + ->willReturnCallback(function ($path) use ($storage) { + return [$storage, $path]; + }); + $view->method('getAbsolutePath')->willReturnArgument(0); + $view->method('getRelativePath')->willReturnArgument(0); if ($thrownException !== null) { $storage->expects($this->once()) @@ -362,7 +361,7 @@ function ($path) use ($storage) { } else { $storage->expects($this->once()) ->method('fopen') - ->will($this->returnValue(false)); + ->willReturn(false); } $view->expects($this->any()) @@ -774,7 +773,7 @@ public function testPutOverwriteFileTriggersHooks() { * if the passed view was chrooted (can happen with public webdav * where the root is the share root) */ - public function testPutSingleFileTriggersHooksDifferentRoot() { + public function testPutSingleFileTriggersHooksDifferentRoot(): void { $view = Filesystem::getView(); $view->mkdir('noderoot'); diff --git a/apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php index 61b35a748307..e8bcbc200498 100644 --- a/apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php @@ -612,6 +612,10 @@ public function testAdditionalHeaders() { ->expects($this->once()) ->method('getName') ->willReturn('somefile.xml'); + $node + ->expects($this->once()) + ->method('getContentDispositionFileName') + ->willReturn('somefile.xml'); $this->tree ->expects($this->once()) diff --git a/apps/dav/tests/unit/Connector/Sabre/FilesReportPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/FilesReportPluginTest.php index 2dda24113852..ed3167881e16 100644 --- a/apps/dav/tests/unit/Connector/Sabre/FilesReportPluginTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/FilesReportPluginTest.php @@ -25,45 +25,57 @@ namespace OCA\DAV\Tests\unit\Connector\Sabre; use OC\Files\View; +use OCA\DAV\Connector\Sabre\Directory; +use OCA\DAV\Connector\Sabre\FilesPlugin; use OCA\DAV\Connector\Sabre\FilesReportPlugin as FilesReportPluginImplementation; use OCA\DAV\Files\Xml\FilterRequest; +use OCP\Files\File; use OCP\Files\Folder; use OCP\IConfig; use OCP\IGroupManager; use OCP\IRequest; use OCP\ITags; +use OCP\IUserSession; use OCP\SystemTag\ISystemTagManager; use OCP\SystemTag\ISystemTagObjectMapper; - -class FilesReportPluginTest extends \Test\TestCase { - /** @var \Sabre\DAV\Server|\PHPUnit\Framework\MockObject\MockObject */ +use OCP\SystemTag\TagNotFoundException; +use PHPUnit\Framework\MockObject\MockObject; +use Sabre\DAV\Server; +use Sabre\DAV\Tree; +use Sabre\HTTP\ResponseInterface; +use Test\TestCase; +use function array_keys; +use function array_values; + +class FilesReportPluginTest extends TestCase { + /** @var Server|MockObject */ private $server; - /** @var \Sabre\DAV\Tree|\PHPUnit\Framework\MockObject\MockObject */ + /** @var Tree|MockObject */ private $tree; - /** @var ISystemTagObjectMapper|\PHPUnit\Framework\MockObject\MockObject */ + /** @var ISystemTagObjectMapper|MockObject */ private $tagMapper; - /** @var ISystemTagManager|\PHPUnit\Framework\MockObject\MockObject */ + /** @var ISystemTagManager|MockObject */ private $tagManager; - /** @var ITags|\PHPUnit\Framework\MockObject\MockObject */ + /** @var ITags|MockObject */ private $privateTags; - /** @var \OCP\IUserSession */ + /** @var IUserSession */ private $userSession; /** @var FilesReportPluginImplementation */ private $plugin; - /** @var View|\PHPUnit\Framework\MockObject\MockObject **/ + /** @var View|MockObject **/ private $view; - /** @var IGroupManager|\PHPUnit\Framework\MockObject\MockObject **/ + /** @var IGroupManager|MockObject **/ private $groupManager; - /** @var Folder|\PHPUnit\Framework\MockObject\MockObject **/ + /** @var Folder|MockObject **/ private $userFolder; public function setUp(): void { @@ -81,7 +93,7 @@ public function setUp(): void { $this->server->expects($this->any()) ->method('getBaseUri') - ->will($this->returnValue('http://example.com/owncloud/remote.php/dav')); + ->willReturn('http://example.com/owncloud/remote.php/dav'); $this->groupManager = $this->getMockBuilder('\OCP\IGroupManager') ->disableOriginalConstructor() @@ -99,19 +111,19 @@ public function setUp(): void { $privateTagManager->expects($this->any()) ->method('load') ->with('files') - ->will($this->returnValue($this->privateTags)); + ->willReturn($this->privateTags); $user = $this->createMock('\OCP\IUser'); $user->expects($this->any()) ->method('getUID') - ->will($this->returnValue('testuser')); + ->willReturn('testuser'); $this->userSession->expects($this->any()) ->method('getUser') - ->will($this->returnValue($user)); + ->willReturn($user); // add FilesPlugin to test more properties $this->server->addPlugin( - new \OCA\DAV\Connector\Sabre\FilesPlugin( + new FilesPlugin( $this->tree, $this->createMock(IConfig::class), $this->createMock(IRequest::class) @@ -179,7 +191,7 @@ public function testOnReport() { $this->groupManager->expects($this->any()) ->method('isAdmin') - ->will($this->returnValue(true)); + ->willReturn(true); $this->tagMapper ->expects($this->exactly(2)) @@ -193,8 +205,9 @@ public function testOnReport() { ['111', '222', '333'], ); - $reportTargetNode = $this->createMock(\OCA\DAV\Connector\Sabre\Directory::class); - $response = $this->createMock(\Sabre\HTTP\ResponseInterface::class); + $reportTargetNode = $this->createMock(Directory::class); + $reportTargetNode->method('getPath')->willReturn(''); + $response = $this->createMock(ResponseInterface::class); $response->expects($this->once()) ->method('setHeader') ->with('Content-Type', 'application/xml; charset=utf-8'); @@ -209,14 +222,14 @@ public function testOnReport() { $this->tree->expects($this->any()) ->method('getNodeForPath') ->with('/' . $path) - ->will($this->returnValue($reportTargetNode)); + ->willReturn($reportTargetNode); - $filesNode1 = $this->createMock(\OCP\Files\Folder::class); + $filesNode1 = $this->createMock(Folder::class); $filesNode1->method('getId')->willReturn(111); $filesNode1->method('getPath')->willReturn('/node1'); $filesNode1->method('isReadable')->willReturn(true); $filesNode1->method('getSize')->willReturn(2048); - $filesNode2 = $this->createMock(\OCP\Files\File::class); + $filesNode2 = $this->createMock(File::class); $filesNode2->method('getId')->willReturn(222); $filesNode2->method('getPath')->willReturn('/sub/node2'); $filesNode2->method('getSize')->willReturn(1024); @@ -236,17 +249,17 @@ public function testOnReport() { $this->server->expects($this->any()) ->method('getRequestUri') - ->will($this->returnValue($path)); + ->willReturn($path); $this->server->httpResponse = $response; $this->plugin->initialize($this->server); $responses = null; $this->server->expects($this->once()) ->method('generateMultiStatus') - ->will( - $this->returnCallback(function ($responsesArg) use (&$responses) { + ->willReturnCallback( + function ($responsesArg) use (&$responses) { $responses = $responsesArg; - }) + } ); $this->assertFalse($this->plugin->onReport(FilesReportPluginImplementation::REPORT_NAME, $parameters, '/' . $path)); @@ -273,7 +286,7 @@ public function testOnReport() { $this->assertCount(0, $props2[200]['{DAV:}resourcetype']->getValue()); } - public function testOnReportPaginationFiltered() { + public function testOnReportPaginationFiltered(): void { $path = 'test'; $parameters = new FilterRequest(); @@ -291,7 +304,7 @@ public function testOnReportPaginationFiltered() { $filesNodes = []; for ($i = 0; $i < 20; $i++) { - $filesNode = $this->createMock(\OCP\Files\File::class); + $filesNode = $this->createMock(File::class); $filesNode->method('getId')->willReturn(1000 + $i); $filesNode->method('getPath')->willReturn('/nodes/node' . $i); $filesNode->method('isReadable')->willReturn(true); @@ -301,14 +314,15 @@ public function testOnReportPaginationFiltered() { // return all above nodes as favorites $this->privateTags->expects($this->once()) ->method('getFavorites') - ->will($this->returnValue(\array_keys($filesNodes))); + ->willReturn(array_keys($filesNodes)); - $reportTargetNode = $this->createMock(\OCA\DAV\Connector\Sabre\Directory::class); + $reportTargetNode = $this->createMock(Directory::class); + $reportTargetNode->method('getPath')->willReturn('/'); $this->tree->expects($this->any()) ->method('getNodeForPath') ->with('/' . $path) - ->will($this->returnValue($reportTargetNode)); + ->willReturn($reportTargetNode); // getById must only be called for the required nodes $this->userFolder @@ -327,17 +341,17 @@ public function testOnReportPaginationFiltered() { $this->server->expects($this->any()) ->method('getRequestUri') - ->will($this->returnValue($path)); + ->willReturn($path); $this->plugin->initialize($this->server); $responses = null; $this->server->expects($this->once()) ->method('generateMultiStatus') - ->will( - $this->returnCallback(function ($responsesArg) use (&$responses) { + ->willReturnCallback( + function ($responsesArg) use (&$responses) { $responses = $responsesArg; - }) + } ); $this->assertFalse($this->plugin->onReport(FilesReportPluginImplementation::REPORT_NAME, $parameters, '/' . $path)); @@ -383,7 +397,7 @@ public function testFindNodesByFileIdsRoot() { [$filesNode2], ); - /** @var \OCA\DAV\Connector\Sabre\Directory|\PHPUnit\Framework\MockObject\MockObject $reportTargetNode */ + /** @var Directory|MockObject $reportTargetNode */ $result = $this->plugin->findNodesByFileIds($reportTargetNode, ['111', '222']); $this->assertCount(2, $result); @@ -436,7 +450,7 @@ public function testFindNodesByFileIdsSubDir() { [$filesNode2], ); - /** @var \OCA\DAV\Connector\Sabre\Directory|\PHPUnit\Framework\MockObject\MockObject $reportTargetNode */ + /** @var Directory|MockObject $reportTargetNode */ $result = $this->plugin->findNodesByFileIds($reportTargetNode, ['111', '222']); $this->assertCount(2, $result); @@ -489,7 +503,7 @@ public function testProcessFilterRulesAndCondition() { 'favorite' => null ]; - $this->assertEquals(['222'], \array_values(self::invokePrivate($this->plugin, 'processFilterRules', [$rules]))); + $this->assertEquals(['222'], array_values(self::invokePrivate($this->plugin, 'processFilterRules', [$rules]))); } public function testProcessFilterRulesAndConditionWithOneEmptyResult() { @@ -513,7 +527,7 @@ public function testProcessFilterRulesAndConditionWithOneEmptyResult() { 'favorite' => null ]; - $this->assertEquals([], \array_values(self::invokePrivate($this->plugin, 'processFilterRules', [$rules]))); + $this->assertEquals([], array_values(self::invokePrivate($this->plugin, 'processFilterRules', [$rules]))); } public function testProcessFilterRulesAndConditionWithFirstEmptyResult() { @@ -537,7 +551,7 @@ public function testProcessFilterRulesAndConditionWithFirstEmptyResult() { 'favorite' => null ]; - $this->assertEquals([], \array_values(self::invokePrivate($this->plugin, 'processFilterRules', [$rules]))); + $this->assertEquals([], array_values(self::invokePrivate($this->plugin, 'processFilterRules', [$rules]))); } public function testProcessFilterRulesAndConditionWithEmptyMidResult() { @@ -563,7 +577,7 @@ public function testProcessFilterRulesAndConditionWithEmptyMidResult() { 'favorite' => null ]; - $this->assertEquals([], \array_values(self::invokePrivate($this->plugin, 'processFilterRules', [$rules]))); + $this->assertEquals([], array_values(self::invokePrivate($this->plugin, 'processFilterRules', [$rules]))); } public function testProcessFilterRulesInvisibleTagAsAdmin() { @@ -608,13 +622,13 @@ public function testProcessFilterRulesInvisibleTagAsAdmin() { 'favorite' => null ]; - $this->assertEquals(['222'], \array_values(self::invokePrivate($this->plugin, 'processFilterRules', [$rules]))); + $this->assertEquals(['222'], array_values(self::invokePrivate($this->plugin, 'processFilterRules', [$rules]))); } /** */ public function testProcessFilterRulesInvisibleTagAsUser() { - $this->expectException(\OCP\SystemTag\TagNotFoundException::class); + $this->expectException(TagNotFoundException::class); $this->groupManager->expects($this->any()) ->method('isAdmin') @@ -692,7 +706,7 @@ public function testProcessFilterRulesVisibleTagAsUser() { 'favorite' => null ]; - $this->assertEquals(['222'], \array_values(self::invokePrivate($this->plugin, 'processFilterRules', [$rules]))); + $this->assertEquals(['222'], array_values(self::invokePrivate($this->plugin, 'processFilterRules', [$rules]))); } public function testProcessFavoriteFilter() { @@ -705,7 +719,7 @@ public function testProcessFavoriteFilter() { ->method('getFavorites') ->will($this->returnValue(['456', '789'])); - $this->assertEquals(['456', '789'], \array_values(self::invokePrivate($this->plugin, 'processFilterRules', [$rules]))); + $this->assertEquals(['456', '789'], array_values(self::invokePrivate($this->plugin, 'processFilterRules', [$rules]))); } public function filesBaseUriProvider() { diff --git a/apps/dav/tests/unit/Connector/Sabre/PrincipalTest.php b/apps/dav/tests/unit/Connector/Sabre/PrincipalTest.php index 7374792ac287..ecedf884193d 100644 --- a/apps/dav/tests/unit/Connector/Sabre/PrincipalTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/PrincipalTest.php @@ -24,67 +24,75 @@ namespace OCA\DAV\Tests\unit\Connector\Sabre; +use OCA\DAV\Connector\Sabre\Principal; use OCP\IGroupManager; use OCP\IUserManager; +use Sabre\DAV\Exception; use Sabre\DAV\PropPatch; use Test\TestCase; +use OC\User\User; +use OCP\IGroup; class PrincipalTest extends TestCase { /** @var IUserManager | \PHPUnit\Framework\MockObject\MockObject */ private $userManager; - /** @var \OCA\DAV\Connector\Sabre\Principal */ + /** @var Principal */ private $connector; /** @var IGroupManager | \PHPUnit\Framework\MockObject\MockObject */ private $groupManager; public function setUp(): void { - $this->userManager = $this->getMockBuilder('\OCP\IUserManager') + $this->userManager = $this->getMockBuilder(IUserManager::class) ->disableOriginalConstructor()->getMock(); - $this->groupManager = $this->getMockBuilder('\OCP\IGroupManager') + $this->groupManager = $this->getMockBuilder(IGroupManager::class) ->disableOriginalConstructor()->getMock(); - $this->connector = new \OCA\DAV\Connector\Sabre\Principal( + $this->connector = new Principal( $this->userManager, $this->groupManager ); parent::setUp(); } - public function testGetPrincipalsByPrefixWithoutPrefix() { + public function testGetPrincipalsByPrefixWithoutPrefix(): void { $response = $this->connector->getPrincipalsByPrefix(''); $this->assertSame([], $response); } - public function testGetPrincipalsByPrefixWithUsers() { - $fooUser = $this->getMockBuilder('\OC\User\User') + public function testGetPrincipalsByPrefixWithUsers(): void { + $fooUser = $this->getMockBuilder(User::class) ->disableOriginalConstructor()->getMock(); $fooUser - ->expects($this->exactly(1)) + ->expects($this->once()) ->method('getUID') - ->will($this->returnValue('foo')); + ->willReturn('foo'); $fooUser - ->expects($this->exactly(1)) + ->expects($this->once()) ->method('getDisplayName') - ->will($this->returnValue('Dr. Foo-Bar')); + ->willReturn('Dr. Foo-Bar'); $fooUser - ->expects($this->exactly(1)) + ->expects($this->once()) ->method('getEMailAddress') - ->will($this->returnValue('')); - $barUser = $this->getMockBuilder('\OC\User\User') + ->willReturn(''); + $barUser = $this->getMockBuilder(User::class) ->disableOriginalConstructor()->getMock(); $barUser - ->expects($this->exactly(1)) + ->expects($this->once()) ->method('getUID') - ->will($this->returnValue('bar')); + ->willReturn('bar'); + $barUser + ->expects($this->once()) + ->method('getDisplayName') + ->willReturn('bar'); $barUser - ->expects($this->exactly(1)) + ->expects($this->once()) ->method('getEMailAddress') - ->will($this->returnValue('bar@owncloud.com')); + ->willReturn('bar@owncloud.com'); $this->userManager ->expects($this->once()) ->method('search') ->with('') - ->will($this->returnValue([$fooUser, $barUser])); + ->willReturn([$fooUser, $barUser]); $expectedResponse = [ 0 => [ @@ -101,29 +109,33 @@ public function testGetPrincipalsByPrefixWithUsers() { $this->assertSame($expectedResponse, $response); } - public function testGetPrincipalsByPrefixEmpty() { + public function testGetPrincipalsByPrefixEmpty(): void { $this->userManager ->expects($this->once()) ->method('search') ->with('') - ->will($this->returnValue([])); + ->willReturn([]); $response = $this->connector->getPrincipalsByPrefix('principals/users'); $this->assertSame([], $response); } - public function testGetPrincipalsByPathWithoutMail() { - $fooUser = $this->getMockBuilder('\OC\User\User') + public function testGetPrincipalsByPathWithoutMail(): void { + $fooUser = $this->getMockBuilder(User::class) ->disableOriginalConstructor()->getMock(); $fooUser - ->expects($this->exactly(1)) + ->expects($this->once()) ->method('getUID') - ->will($this->returnValue('foo')); + ->willReturn('foo'); + $fooUser + ->expects($this->once()) + ->method('getDisplayname') + ->willReturn('foo'); $this->userManager ->expects($this->once()) ->method('get') ->with('foo') - ->will($this->returnValue($fooUser)); + ->willReturn($fooUser); $expectedResponse = [ 'uri' => 'principals/users/foo', @@ -133,22 +145,26 @@ public function testGetPrincipalsByPathWithoutMail() { $this->assertSame($expectedResponse, $response); } - public function testGetPrincipalsByPathWithMail() { - $fooUser = $this->getMockBuilder('\OC\User\User') + public function testGetPrincipalsByPathWithMail(): void { + $fooUser = $this->getMockBuilder(User::class) ->disableOriginalConstructor()->getMock(); $fooUser - ->expects($this->exactly(1)) + ->expects($this->once()) ->method('getEMailAddress') - ->will($this->returnValue('foo@owncloud.com')); + ->willReturn('foo@owncloud.com'); $fooUser - ->expects($this->exactly(1)) - ->method('getUID') - ->will($this->returnValue('foo')); + ->expects($this->once()) + ->method('getUID') + ->willReturn('foo'); + $fooUser + ->expects($this->once()) + ->method('getDisplayName') + ->willReturn('foo'); $this->userManager ->expects($this->once()) ->method('get') ->with('foo') - ->will($this->returnValue($fooUser)); + ->willReturn($fooUser); $expectedResponse = [ 'uri' => 'principals/users/foo', @@ -159,29 +175,29 @@ public function testGetPrincipalsByPathWithMail() { $this->assertSame($expectedResponse, $response); } - public function testGetPrincipalsByPathEmpty() { + public function testGetPrincipalsByPathEmpty(): void { $this->userManager ->expects($this->once()) ->method('get') ->with('foo') - ->will($this->returnValue(null)); + ->willReturn(null); $response = $this->connector->getPrincipalByPath('principals/users/foo'); $this->assertNull($response); } - public function testGetGroupMemberSet() { - $fooUser = $this->getMockBuilder('\OC\User\User') + public function testGetGroupMemberSet(): void { + $fooUser = $this->getMockBuilder(User::class) ->disableOriginalConstructor()->getMock(); $fooUser - ->expects($this->exactly(1)) + ->expects($this->once()) ->method('getUID') - ->will($this->returnValue('foo')); + ->willReturn('foo'); $this->userManager ->expects($this->once()) ->method('get') ->with('foo') - ->will($this->returnValue($fooUser)); + ->willReturn($fooUser); $response = $this->connector->getGroupMemberSet('principals/users/foo'); $this->assertSame(['principals/users/foo'], $response); @@ -189,23 +205,23 @@ public function testGetGroupMemberSet() { /** */ - public function testGetGroupMemberSetEmpty() { - $this->expectException(\Sabre\DAV\Exception::class); + public function testGetGroupMemberSetEmpty(): void { + $this->expectException(Exception::class); $this->expectExceptionMessage('Principal not found'); $this->userManager ->expects($this->once()) ->method('get') ->with('foo') - ->will($this->returnValue(null)); + ->willReturn(null); $this->connector->getGroupMemberSet('principals/users/foo'); } - public function testGetGroupMembership() { - $fooUser = $this->getMockBuilder('\OC\User\User') + public function testGetGroupMembership(): void { + $fooUser = $this->getMockBuilder(User::class) ->disableOriginalConstructor()->getMock(); - $group = $this->getMockBuilder('\OCP\IGroup') + $group = $this->getMockBuilder(IGroup::class) ->disableOriginalConstructor()->getMock(); $group->expects($this->once()) ->method('getGID') @@ -229,45 +245,43 @@ public function testGetGroupMembership() { $this->assertSame($expectedResponse, $response); } - /** - */ - public function testGetGroupMembershipEmpty() { - $this->expectException(\Sabre\DAV\Exception::class); + public function testGetGroupMembershipEmpty(): void { + $this->expectException(Exception::class); $this->expectExceptionMessage('Principal not found'); $this->userManager ->expects($this->once()) ->method('get') ->with('foo') - ->will($this->returnValue(null)); + ->willReturn(null); $this->connector->getGroupMembership('principals/users/foo'); } /** */ - public function testSetGroupMembership() { - $this->expectException(\Sabre\DAV\Exception::class); + public function testSetGroupMembership(): void { + $this->expectException(Exception::class); $this->expectExceptionMessage('Setting members of the group is not supported yet'); $this->connector->setGroupMemberSet('principals/users/foo', ['foo']); } - public function testUpdatePrincipal() { + public function testUpdatePrincipal(): void { $this->assertSame(0, $this->connector->updatePrincipal('foo', new PropPatch([]))); } - public function testSearchPrincipals() { + public function testSearchPrincipals(): void { $this->assertSame([], $this->connector->searchPrincipals('principals/users', [])); } - public function testFindByUri() { - $fooUser = $this->getMockBuilder('\OC\User\User') + public function testFindByUri(): void { + $fooUser = $this->getMockBuilder(User::class) ->disableOriginalConstructor()->getMock(); $fooUser - ->expects($this->exactly(1)) + ->expects($this->once()) ->method('getUID') - ->will($this->returnValue('foo')); + ->willReturn('foo'); $this->userManager->expects($this->once())->method('getByEmail')->willReturn([ $fooUser diff --git a/apps/federatedfilesharing/lib/Controller/RequestHandlerController.php b/apps/federatedfilesharing/lib/Controller/RequestHandlerController.php index a67094929978..df84d9868ac8 100644 --- a/apps/federatedfilesharing/lib/Controller/RequestHandlerController.php +++ b/apps/federatedfilesharing/lib/Controller/RequestHandlerController.php @@ -111,7 +111,7 @@ public function createShare() { null ); - if (\strlen($token) > 128) { + if ($token === null || \strlen($token) > 128) { throw new BadRequestException('Token too long'); } diff --git a/apps/federatedfilesharing/lib/FederatedShareProvider.php b/apps/federatedfilesharing/lib/FederatedShareProvider.php index 20cf0d4d9e6f..0519cd7ffc79 100644 --- a/apps/federatedfilesharing/lib/FederatedShareProvider.php +++ b/apps/federatedfilesharing/lib/FederatedShareProvider.php @@ -728,7 +728,7 @@ public function getSharesBy($userId, $shareType, $node, $reshares, $limit, $offs * @inheritdoc */ public function getShareById($id, $recipientId = null) { - if (!ctype_digit($id)) { + if (!ctype_digit((string)$id)) { // share id is defined as a field of type integer // if someone calls the API asking for a share id like "abc" or "42.1" // then there is no point trying to query the database, diff --git a/apps/federatedfilesharing/tests/Controller/OcmControllerTest.php b/apps/federatedfilesharing/tests/Controller/OcmControllerTest.php index 6532d544a783..fff53ca61b20 100644 --- a/apps/federatedfilesharing/tests/Controller/OcmControllerTest.php +++ b/apps/federatedfilesharing/tests/Controller/OcmControllerTest.php @@ -115,6 +115,8 @@ protected function setUp(): void { $this->logger = $this->createMock(ILogger::class); $this->config = $this->createMock(IConfig::class); + $this->urlGenerator->method('linkToRouteAbsolute')->willReturn(''); + $this->ocmController = new OcmController( 'federatedfilesharing', $this->request, diff --git a/apps/federatedfilesharing/tests/Panels/GeneralPersonalPanelTest.php b/apps/federatedfilesharing/tests/Panels/GeneralPersonalPanelTest.php index 602ef9c4f0b2..d5e6e5c92671 100644 --- a/apps/federatedfilesharing/tests/Panels/GeneralPersonalPanelTest.php +++ b/apps/federatedfilesharing/tests/Panels/GeneralPersonalPanelTest.php @@ -49,6 +49,10 @@ class GeneralPersonalPanelTest extends \Test\TestCase { public function setUp(): void { parent::setUp(); $this->l = $this->getMockBuilder(IL10N::class)->getMock(); + $this->l->method('t')->willReturnCallback(function ($text, $parameters = []) { + return \vsprintf($text, $parameters); + }); + $this->urlGenerator = $this->getMockBuilder(IURLGenerator::class)->getMock(); $this->userSession = $this->getMockBuilder(IUserSession::class)->getMock(); $this->request = $this->getMockBuilder(IRequest::class)->getMock(); diff --git a/apps/federatedfilesharing/tests/TestCase.php b/apps/federatedfilesharing/tests/TestCase.php index 5d7ca19fd4c4..aeda7c85f262 100644 --- a/apps/federatedfilesharing/tests/TestCase.php +++ b/apps/federatedfilesharing/tests/TestCase.php @@ -25,6 +25,7 @@ use OC\Files\Filesystem; use OCA\Files\Share; use Test\Traits\UserTrait; +use OCA\Files_Sharing\SharedStorage; /** * Class Test_Files_Sharing_Base @@ -85,8 +86,6 @@ public static function tearDownAfterClass(): void { * @param string $user */ protected static function loginHelper($user) { - self::resetStorage(); - \OC_Util::tearDownFS(); \OC::$server->getUserSession()->setUser(null); \OC\Files\Filesystem::tearDown(); @@ -95,15 +94,4 @@ protected static function loginHelper($user) { \OC_Util::setupFS($user); } - - /** - * reset init status for the share storage - */ - protected static function resetStorage() { - $storage = new \ReflectionClass('\OCA\Files_Sharing\SharedStorage'); - $isInitialized = $storage->getProperty('initialized'); - $isInitialized->setAccessible(true); - $isInitialized->setValue($storage, false); - $isInitialized->setAccessible(false); - } } diff --git a/apps/files/lib/Command/TransferOwnership.php b/apps/files/lib/Command/TransferOwnership.php index a9ff6c54a9ad..ec7e26c459a9 100644 --- a/apps/files/lib/Command/TransferOwnership.php +++ b/apps/files/lib/Command/TransferOwnership.php @@ -153,7 +153,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int $this->sourceUser = $sourceUserObject->getUID(); $this->destinationUser = $destinationUserObject->getUID(); - $this->inputPath = $input->getOption('path'); + $this->inputPath = $input->getOption('path') ?? ''; $this->inputPath = \ltrim($this->inputPath, '/'); // target user has to be ready diff --git a/apps/files/tests/Command/ScanTest.php b/apps/files/tests/Command/ScanTest.php index 9cc270d0333f..601f4727fe27 100644 --- a/apps/files/tests/Command/ScanTest.php +++ b/apps/files/tests/Command/ScanTest.php @@ -91,7 +91,7 @@ class ScanTest extends TestCase { private $commandTester; /** - * @var string[] + * @var array */ private $groupsCreated = []; @@ -118,8 +118,8 @@ protected function setUp(): void { ); $this->commandTester = new CommandTester($command); - $this->scanUser1 = $this->createUser('scanuser1' . \uniqid()); - $this->scanUser2 = $this->createUser('scanuser2' . \uniqid()); + $this->scanUser1 = $this->createUser('scanuser1' . \uniqid('', true)); + $this->scanUser2 = $this->createUser('scanuser2' . \uniqid('', true)); $user1 = $this->createUser('user1'); $this->createUser('user2'); diff --git a/apps/files_external/appinfo/Migrations/Version20220329110116.php b/apps/files_external/appinfo/Migrations/Version20220329110116.php index 62ef9ad00166..d0f322c94941 100644 --- a/apps/files_external/appinfo/Migrations/Version20220329110116.php +++ b/apps/files_external/appinfo/Migrations/Version20220329110116.php @@ -12,6 +12,7 @@ use OCP\ILogger; use OCP\IConfig; use phpseclib3\Crypt\RSA as RSACrypt; +use phpseclib3\Crypt\RSA\PrivateKey; class Version20220329110116 implements ISimpleMigration { /** @var IGlobalStoragesService */ diff --git a/apps/files_sharing/lib/Controller/Share20OcsController.php b/apps/files_sharing/lib/Controller/Share20OcsController.php index 0a2d706cb78b..6362dfa580cd 100644 --- a/apps/files_sharing/lib/Controller/Share20OcsController.php +++ b/apps/files_sharing/lib/Controller/Share20OcsController.php @@ -1173,10 +1173,10 @@ protected function canAccessShare(IShare $share) { * * @param string $expireDate * - * @throws Exception * @return \DateTime + *@throws Exception */ - private function parseDate($expireDate) { + private function parseDate(string $expireDate) { try { $date = new \DateTime($expireDate); } catch (Exception $e) { diff --git a/apps/files_sharing/lib/Controller/ShareesController.php b/apps/files_sharing/lib/Controller/ShareesController.php index ecf6b9bfa22e..7287e83d5120 100644 --- a/apps/files_sharing/lib/Controller/ShareesController.php +++ b/apps/files_sharing/lib/Controller/ShareesController.php @@ -226,7 +226,7 @@ protected function getUsers($search) { // Check if exact display name || \strtolower($user->getDisplayName()) === $lowerSearch // Check if exact first email - || \strtolower($user->getEMailAddress()) === $lowerSearch + || \strtolower($user->getEMailAddress() ?? '') === $lowerSearch // Check for exact search term matches (when mail attributes configured as search terms + no enumeration) || \in_array($lowerSearch, \array_map('strtolower', $user->getSearchTerms())) ) diff --git a/apps/files_sharing/tests/ApiTest.php b/apps/files_sharing/tests/ApiTest.php index ee7a08558604..082fb848341d 100644 --- a/apps/files_sharing/tests/ApiTest.php +++ b/apps/files_sharing/tests/ApiTest.php @@ -1,4 +1,5 @@ * @author Joas Schilling diff --git a/apps/files_sharing/tests/Controller/Share20OcsControllerTest.php b/apps/files_sharing/tests/Controller/Share20OcsControllerTest.php index 9a671357c788..9f583ecc2e23 100644 --- a/apps/files_sharing/tests/Controller/Share20OcsControllerTest.php +++ b/apps/files_sharing/tests/Controller/Share20OcsControllerTest.php @@ -44,7 +44,6 @@ use OCP\IUserSession; use OCP\Lock\ILockingProvider; use OCP\Lock\LockedException; -use OCP\Share; use OCP\User\Constants; use PHPUnit\Framework\MockObject\MockObject; use Symfony\Component\EventDispatcher\EventDispatcher; @@ -56,6 +55,10 @@ use OCP\Share\IShare; use OCP\Share\IAttributes as IShareAttributes; use OCP\Share\IManager; +use OCP\Files\File; +use OC\Files\Cache\Cache; +use OC\Files\Storage\Storage; +use OCP\Files\Cache\ICache; /** * Class Share20OcsControllerTest @@ -114,11 +117,9 @@ protected function setUp(): void { ->disableOriginalConstructor() ->getMock(); $this->shareManager - ->expects($this->any()) ->method('shareApiEnabled') ->willReturn(true); $this->shareManager - ->expects($this->any()) ->method('newShare') ->willReturn($this->newShare()); $this->shareManager @@ -148,18 +149,18 @@ protected function setUp(): void { $this->sharee = $this->createMock(IUser::class); $this->sharee->method('getUID')->willReturn('validUser'); - $this->l = $this->createMock('\OCP\IL10N'); + $this->l = $this->createMock(IL10N::class); $this->l->method('t') - ->will($this->returnCallback(function ($text, $parameters = []) { + ->willReturnCallback(function ($text, $parameters = []) { return \vsprintf($text, $parameters); - })); + }); $this->config = $this->createMock(IConfig::class); $this->config->method('getAppValue') - ->will($this->returnValueMap([ + ->willReturnMap([ ['core', 'shareapi_default_permissions', \OCP\Constants::PERMISSION_ALL, \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_CREATE], ['core', 'shareapi_auto_accept_share', 'yes', 'yes'], - ])); + ]); $this->notificationPublisher = $this->createMock(NotificationPublisher::class); $this->eventDispatcher = $this->createMock(EventDispatcher::class); @@ -167,7 +168,6 @@ protected function setUp(): void { $this->sharingAllowlist= $this->createMock(SharingAllowlist::class); $this->userTypeHelper = $this->createMock(UserTypeHelper::class); $this->userTypeHelper - ->expects($this->any()) ->method('getUserType') ->willReturn(Constants::USER_TYPE_USER); @@ -215,7 +215,7 @@ private function mockFormatShare() { ->getMock(); } - private function newShare() { + private function newShare(): IShare { return \OC::$server->getShareManager()->newShare(); } @@ -234,7 +234,7 @@ private function getGroupMock(array $attrs) { return $groupMock; } - private function mockShareAttributes() { + private function mockShareAttributes(): array { $formattedShareAttributes = [ [ [ @@ -253,17 +253,17 @@ private function mockShareAttributes() { return [$shareAttributes, \json_encode($formattedShareAttributes)]; } - public function testDeleteShareShareNotFound() { + public function testDeleteShareShareNotFound(): void { $this->shareManager ->expects($this->exactly(2)) ->method('getShareById') - ->will($this->returnCallback(function ($id) { + ->willReturnCallback(function ($id) { if ($id === 'ocinternal:42' || $id === 'ocFederatedSharing:42') { - throw new \OCP\Share\Exceptions\ShareNotFound(); - } else { - throw new \Exception(); + throw new ShareNotFound(); } - })); + + throw new \Exception(); + }); $this->shareManager->method('outgoingServer2ServerSharesAllowed')->willReturn(true); @@ -271,8 +271,8 @@ public function testDeleteShareShareNotFound() { $this->assertEquals($expected, $this->ocs->deleteShare(42)); } - public function testDeleteShare() { - $node = $this->createMock('\OCP\Files\File'); + public function testDeleteShare(): void { + $node = $this->createMock(File::class); $share = $this->newShare(); $share->setSharedBy($this->currentUser->getUID()) @@ -298,8 +298,8 @@ public function testDeleteShare() { $this->assertEquals($expected, $this->ocs->deleteShare(42)); } - public function testDeleteShareLocked() { - $node = $this->createMock('\OCP\Files\File'); + public function testDeleteShareLocked(): void { + $node = $this->createMock(File::class); $share = $this->newShare(); $share->setSharedBy($this->currentUser->getUID()) @@ -379,52 +379,52 @@ public function createShare( $share->method('getPassword')->willReturn($password); $share->method('getName')->willReturn($name); - if ($shareType === Share::SHARE_TYPE_USER || - $shareType === Share::SHARE_TYPE_GROUP || - $shareType === Share::SHARE_TYPE_LINK) { + if ($shareType === \OC\Share\Constants::SHARE_TYPE_USER || + $shareType === \OC\Share\Constants::SHARE_TYPE_GROUP || + $shareType === \OC\Share\Constants::SHARE_TYPE_LINK) { $share->method('getFullId')->willReturn('ocinternal:'.$id); } return $share; } - public function dataGetShare() { + public function dataGetShare(): array { $data = []; - $cache = $this->getMockBuilder('OC\Files\Cache\Cache') + $cache = $this->getMockBuilder(Cache::class) ->disableOriginalConstructor() ->getMock(); $cache->method('getNumericStorageId')->willReturn(101); - $storage = $this->getMockBuilder('OC\Files\Storage\Storage') + $storage = $this->getMockBuilder(Storage::class) ->disableOriginalConstructor() ->getMock(); $storage->method('getId')->willReturn('STORAGE'); $storage->method('getCache')->willReturn($cache); - $parentFolder = $this->createMock('OCP\Files\Folder'); + $parentFolder = $this->createMock(Folder::class); $parentFolder->method('getId')->willReturn(3); - $file = $this->createMock('OCP\Files\File'); + $file = $this->createMock(File::class); $file->method('getId')->willReturn(1); $file->method('getPath')->willReturn('file'); $file->method('getStorage')->willReturn($storage); $file->method('getParent')->willReturn($parentFolder); $file->method('getMimeType')->willReturn('myMimeType'); - $folder = $this->createMock('OCP\Files\Folder'); + $folder = $this->createMock(Folder::class); $folder->method('getId')->willReturn(2); $folder->method('getPath')->willReturn('folder'); $folder->method('getStorage')->willReturn($storage); $folder->method('getParent')->willReturn($parentFolder); $folder->method('getMimeType')->willReturn('myFolderMimeType'); - list($shareAttributes, $shareAttributesReturnJson) = $this->mockShareAttributes(); + [$shareAttributes, $shareAttributesReturnJson] = $this->mockShareAttributes(); // File shared with user $share = $this->createShare( 100, - Share::SHARE_TYPE_USER, + \OC\Share\Constants::SHARE_TYPE_USER, 'userId', 'initiatorId', 'ownerId', @@ -442,7 +442,7 @@ public function dataGetShare() { ); $expected = [ 'id' => 100, - 'share_type' => Share::SHARE_TYPE_USER, + 'share_type' => \OC\Share\Constants::SHARE_TYPE_USER, 'share_with' => 'userId', 'share_with_displayname' => 'userDisplay', 'share_with_user_type' => Constants::USER_TYPE_USER, @@ -475,7 +475,7 @@ public function dataGetShare() { // Folder shared with group $share = $this->createShare( 101, - Share::SHARE_TYPE_GROUP, + \OC\Share\Constants::SHARE_TYPE_GROUP, 'groupId', 'initiatorId', 'ownerId', @@ -493,7 +493,7 @@ public function dataGetShare() { ); $expected = [ 'id' => 101, - 'share_type' => Share::SHARE_TYPE_GROUP, + 'share_type' => \OC\Share\Constants::SHARE_TYPE_GROUP, 'share_with' => 'groupId', 'share_with_displayname' => 'groupId', 'uid_owner' => 'initiatorId', @@ -525,7 +525,7 @@ public function dataGetShare() { $expire = \DateTime::createFromFormat('Y-m-d h:i:s', '2000-01-02 01:02:03'); $share = $this->createShare( 101, - Share::SHARE_TYPE_LINK, + \OC\Share\Constants::SHARE_TYPE_LINK, null, 'initiatorId', 'ownerId', @@ -542,7 +542,7 @@ public function dataGetShare() { ); $expected = [ 'id' => 101, - 'share_type' => Share::SHARE_TYPE_LINK, + 'share_type' => \OC\Share\Constants::SHARE_TYPE_LINK, 'share_with' => '***redacted***', 'share_with_displayname' => '***redacted***', 'uid_owner' => 'initiatorId', @@ -578,7 +578,7 @@ public function dataGetShare() { /** * @dataProvider dataGetShare */ - public function testGetShare(\OCP\Share\IShare $share, array $result) { + public function testGetShare(IShare $share, array $result): void { $ocs = $this->getMockBuilder(Share20OcsController::class) ->setConstructorArgs([ 'files_sharing', @@ -599,7 +599,10 @@ public function testGetShare(\OCP\Share\IShare $share, array $result) { ])->setMethods(['canAccessShare']) ->getMock(); - $ocs->expects($this->any())->method('canAccessShare')->willReturn(true); + $ocs + ->expects($this->once()) + ->method('canAccessShare') + ->willReturn(true); $this->shareManager ->expects($this->once()) @@ -607,7 +610,7 @@ public function testGetShare(\OCP\Share\IShare $share, array $result) { ->with($share->getFullId()) ->willReturn($share); - $userFolder = $this->createMock('OCP\Files\Folder'); + $userFolder = $this->createMock(Folder::class); $userFolder ->method('getRelativePath') ->will($this->returnArgument(0)); @@ -624,35 +627,35 @@ public function testGetShare(\OCP\Share\IShare $share, array $result) { ->method('linkToRouteAbsolute') ->willReturn('url'); - $initiator = $this->createMock('OCP\IUser'); + $initiator = $this->createMock(IUser::class); $initiator->method('getUID')->willReturn('initiatorId'); $initiator->method('getDisplayName')->willReturn('initiatorDisplay'); - $owner = $this->createMock('OCP\IUser'); + $owner = $this->createMock(IUser::class); $owner->method('getUID')->willReturn('ownerId'); $owner->method('getDisplayName')->willReturn('ownerDisplay'); - $user = $this->createMock('OCP\IUser'); + $user = $this->createMock(IUser::class); $user->method('getUID')->willReturn('userId'); $user->method('getDisplayName')->willReturn('userDisplay'); - $group = $this->createMock('OCP\IGroup'); + $group = $this->createMock(IGroup::class); $group->method('getGID')->willReturn('groupId'); - $this->userManager->method('get')->will($this->returnValueMap([ + $this->userManager->method('get')->willReturnMap([ ['userId', false, $user], ['initiatorId', false, $initiator], ['ownerId', false, $owner], - ])); - $this->groupManager->method('get')->will($this->returnValueMap([ + ]); + $this->groupManager->method('get')->willReturnMap([ ['group', $group], - ])); + ]); $expected = new Result([$result]); $this->assertEquals($expected->getData(), $ocs->getShare($share->getId())->getData()); } - public function testGetShareInvalidNode() { + public function testGetShareInvalidNode(): void { $share = \OC::$server->getShareManager()->newShare(); $share->setSharedBy('initiator') ->setSharedWith('recipient') @@ -668,73 +671,73 @@ public function testGetShareInvalidNode() { $this->assertEquals($expected->getMeta(), $this->ocs->getShare(42)->getMeta()); } - public function testCanAccessShare() { - $share = $this->createMock('OCP\Share\IShare'); + public function testCanAccessShare(): void { + $share = $this->createMock(IShare::class); $share->method('getShareOwner')->willReturn($this->currentUser->getUID()); $this->assertTrue(self::invokePrivate($this->ocs, 'canAccessShare', [$share])); - $share = $this->createMock('OCP\Share\IShare'); + $share = $this->createMock(IShare::class); $share->method('getSharedBy')->willReturn($this->currentUser->getUID()); $this->assertTrue(self::invokePrivate($this->ocs, 'canAccessShare', [$share])); - $share = $this->createMock('OCP\Share\IShare'); - $share->method('getShareType')->willReturn(Share::SHARE_TYPE_USER); + $share = $this->createMock(IShare::class); + $share->method('getShareType')->willReturn(\OC\Share\Constants::SHARE_TYPE_USER); $share->method('getSharedWith')->willReturn($this->currentUser->getUID()); $this->assertTrue(self::invokePrivate($this->ocs, 'canAccessShare', [$share])); - $share = $this->createMock('OCP\Share\IShare'); - $share->method('getShareType')->willReturn(Share::SHARE_TYPE_USER); - $share->method('getSharedWith')->willReturn($this->createMock('OCP\IUser')); + $share = $this->createMock(IShare::class); + $share->method('getShareType')->willReturn(\OC\Share\Constants::SHARE_TYPE_USER); + $share->method('getSharedWith')->willReturn($this->createMock(IUser::class)); $this->assertFalse(self::invokePrivate($this->ocs, 'canAccessShare', [$share])); - $share = $this->createMock('OCP\Share\IShare'); - $share->method('getShareType')->willReturn(Share::SHARE_TYPE_GROUP); + $share = $this->createMock(IShare::class); + $share->method('getShareType')->willReturn(\OC\Share\Constants::SHARE_TYPE_GROUP); $share->method('getSharedWith')->willReturn('group'); - $group = $this->createMock('OCP\IGroup'); + $group = $this->createMock(IGroup::class); $group->method('inGroup')->with($this->currentUser)->willReturn(true); - $group2 = $this->createMock('OCP\IGroup'); + $group2 = $this->createMock(IGroup::class); $group2->method('inGroup')->with($this->currentUser)->willReturn(false); - $this->groupManager->method('get')->will($this->returnValueMap([ + $this->groupManager->method('get')->willReturnMap([ ['group', $group], ['group2', $group2], ['groupnull', null], - ])); + ]); $this->assertTrue(self::invokePrivate($this->ocs, 'canAccessShare', [$share])); - $share = $this->createMock('OCP\Share\IShare'); - $share->method('getShareType')->willReturn(Share::SHARE_TYPE_GROUP); + $share = $this->createMock(IShare::class); + $share->method('getShareType')->willReturn(\OC\Share\Constants::SHARE_TYPE_GROUP); $share->method('getSharedWith')->willReturn('group2'); $this->assertFalse(self::invokePrivate($this->ocs, 'canAccessShare', [$share])); // null group - $share = $this->createMock('OCP\Share\IShare'); - $share->method('getShareType')->willReturn(\OCP\Share::SHARE_TYPE_GROUP); + $share = $this->createMock(IShare::class); + $share->method('getShareType')->willReturn(\OC\Share\Constants::SHARE_TYPE_GROUP); $share->method('getSharedWith')->willReturn('groupnull'); $this->assertFalse(self::invokePrivate($this->ocs, 'canAccessShare', [$share])); - $share = $this->createMock('OCP\Share\IShare'); - $share->method('getShareType')->willReturn(Share::SHARE_TYPE_LINK); + $share = $this->createMock(IShare::class); + $share->method('getShareType')->willReturn(\OC\Share\Constants::SHARE_TYPE_LINK); $this->assertFalse(self::invokePrivate($this->ocs, 'canAccessShare', [$share])); // should not happen ever again, but who knows... let's cover it - $share = $this->createMock('OCP\Share\IShare'); - $share->method('getShareType')->willReturn(Share::SHARE_TYPE_USER); - $share->method('getState')->willReturn(Share::STATE_ACCEPTED); + $share = $this->createMock(IShare::class); + $share->method('getShareType')->willReturn(\OC\Share\Constants::SHARE_TYPE_USER); + $share->method('getState')->willReturn(\OC\Share\Constants::STATE_ACCEPTED); $share->method('getPermissions')->willReturn(0); $this->assertFalse(self::invokePrivate($this->ocs, 'canAccessShare', [$share])); // legacy zero permission entries from group sub-shares, let it pass - $share = $this->createMock('OCP\Share\IShare'); - $share->method('getShareType')->willReturn(Share::SHARE_TYPE_GROUP); + $share = $this->createMock(IShare::class); + $share->method('getShareType')->willReturn(\OC\Share\Constants::SHARE_TYPE_GROUP); $share->method('getSharedWith')->willReturn('group'); - $share->method('getState')->willReturn(Share::STATE_REJECTED); + $share->method('getState')->willReturn(\OC\Share\Constants::STATE_REJECTED); $share->method('getPermissions')->willReturn(0); $this->assertTrue(self::invokePrivate($this->ocs, 'canAccessShare', [$share])); } - public function testCreateShareNoPath() { + public function testCreateShareNoPath(): void { $expected = new Result(null, 404, 'Please specify a file or folder path'); $result = $this->ocs->createShare(); @@ -743,14 +746,14 @@ public function testCreateShareNoPath() { $this->assertEquals($expected->getData(), $result->getData()); } - public function testCreateShareInvalidPath() { + public function testCreateShareInvalidPath(): void { $this->request ->method('getParam') - ->will($this->returnValueMap([ + ->willReturnMap([ ['path', null, 'invalid-path'], - ])); + ]); - $userFolder = $this->createMock('\OCP\Files\Folder'); + $userFolder = $this->createMock(Folder::class); $this->rootFolder->expects($this->once()) ->method('getUserFolder') ->with('currentUser') @@ -759,7 +762,7 @@ public function testCreateShareInvalidPath() { $userFolder->expects($this->once()) ->method('get') ->with('invalid-path') - ->will($this->throwException(new \OCP\Files\NotFoundException())); + ->will($this->throwException(new NotFoundException())); $expected = new Result(null, 404, 'Wrong path, file/folder doesn\'t exist'); @@ -769,28 +772,29 @@ public function testCreateShareInvalidPath() { $this->assertEquals($expected->getData(), $result->getData()); } - public function testCreateShareUserNoShareWith() { + public function testCreateShareUserNoShareWith(): void { $share = $this->newShare(); $this->shareManager->method('newShare')->willReturn($share); $this->request ->method('getParam') - ->will($this->returnValueMap([ + ->willReturnMap([ ['path', null, 'valid-path'], ['permissions', null, \OCP\Constants::PERMISSION_ALL], - ['shareType', $this->any(), Share::SHARE_TYPE_USER], - ])); + ['shareType', $this->any(), \OC\Share\Constants::SHARE_TYPE_USER], + ['expireDate', '', ''], + ]); - $userFolder = $this->createMock('\OCP\Files\Folder'); + $userFolder = $this->createMock(Folder::class); $this->rootFolder->expects($this->once()) ->method('getUserFolder') ->with('currentUser') ->willReturn($userFolder); - $path = $this->createMock('\OCP\Files\File'); - $storage = $this->createMock('OCP\Files\Storage'); + $path = $this->createMock(File::class); + $storage = $this->createMock(\OCP\Files\Storage::class); $storage->method('instanceOfStorage') - ->with('OCA\Files_Sharing\External\Storage') + ->with(\OCA\Files_Sharing\External\Storage::class) ->willReturn(false); $path->method('getStorage')->willReturn($storage); $userFolder->expects($this->once()) @@ -812,7 +816,7 @@ public function testCreateShareUserNoShareWith() { $this->assertEquals($expected->getData(), $result->getData()); } - public function InvalidShareWithProvider() { + public function InvalidShareWithProvider(): array { return [ ['invaliduser'], [123456], @@ -824,29 +828,30 @@ public function InvalidShareWithProvider() { * @dataProvider InvalidShareWithProvider * @param mixed $shareWith */ - public function testCreateShareUserNoValidShareWith($shareWith) { + public function testCreateShareUserNoValidShareWith($shareWith): void { $share = $this->newShare(); $this->shareManager->method('newShare')->willReturn($share); $this->request ->method('getParam') - ->will($this->returnValueMap([ + ->willReturnMap([ ['path', null, 'valid-path'], ['permissions', null, \OCP\Constants::PERMISSION_ALL], - ['shareType', $this->any(), Share::SHARE_TYPE_USER], + ['shareType', $this->any(), \OC\Share\Constants::SHARE_TYPE_USER], ['shareWith', $this->any(), $shareWith], - ])); + ['expireDate', '', ''], + ]); - $userFolder = $this->createMock('\OCP\Files\Folder'); + $userFolder = $this->createMock(Folder::class); $this->rootFolder->expects($this->once()) ->method('getUserFolder') ->with('currentUser') ->willReturn($userFolder); - $path = $this->createMock('\OCP\Files\File'); - $storage = $this->createMock('OCP\Files\Storage'); + $path = $this->createMock(File::class); + $storage = $this->createMock(\OCP\Files\Storage::class); $storage->method('instanceOfStorage') - ->with('OCA\Files_Sharing\External\Storage') + ->with(\OCA\Files_Sharing\External\Storage::class) ->willReturn(false); $path->method('getStorage')->willReturn($storage); $userFolder->expects($this->once()) @@ -866,7 +871,7 @@ public function testCreateShareUserNoValidShareWith($shareWith) { $this->assertEquals($expected->getData(), $result->getData()); } - public function testCreateShareUser() { + public function testCreateShareUser(): void { $share = $this->newShare(); $this->shareManager->method('newShare')->willReturn($share); @@ -879,20 +884,21 @@ public function testCreateShareUser() { ->willReturnMap([ ['path', null, 'valid-path'], ['permissions', null, \OCP\Constants::PERMISSION_ALL], - ['shareType', $this->any(), Share::SHARE_TYPE_USER], + ['shareType', $this->any(), \OC\Share\Constants::SHARE_TYPE_USER], ['shareWith', null, 'validUser'], + ['expireDate', '', ''], ]); - $userFolder = $this->createMock('\OCP\Files\Folder'); + $userFolder = $this->createMock(Folder::class); $this->rootFolder->expects($this->once()) ->method('getUserFolder') ->with('currentUser') ->willReturn($userFolder); - $path = $this->createMock('\OCP\Files\File'); - $storage = $this->createMock('OCP\Files\Storage'); + $path = $this->createMock(File::class); + $storage = $this->createMock(\OCP\Files\Storage::class); $storage->method('instanceOfStorage') - ->with('OCA\Files_Sharing\External\Storage') + ->with(\OCA\Files_Sharing\External\Storage::class) ->willReturn(false); $path->method('getStorage')->willReturn($storage); $userFolder->expects($this->once()) @@ -910,12 +916,12 @@ public function testCreateShareUser() { ->with(ILockingProvider::LOCK_SHARED); $this->shareManager->method('createShare') - ->with($this->callback(function (\OCP\Share\IShare $share) use ($path) { + ->with($this->callback(function (IShare $share) use ($path) { return $share->getNode() === $path && $share->getPermissions() === ( \OCP\Constants::PERMISSION_ALL ) && - $share->getShareType() === Share::SHARE_TYPE_USER && + $share->getShareType() === \OC\Share\Constants::SHARE_TYPE_USER && $share->getSharedWith() === 'validUser' && $share->getSharedBy() === 'currentUser'; })) @@ -932,30 +938,31 @@ public function testCreateShareUser() { * @dataProvider InvalidShareWithProvider * @param mixed $shareWith */ - public function testCreateShareGroupNoValidShareWith($shareWith) { + public function testCreateShareGroupNoValidShareWith($shareWith): void { $share = $this->newShare(); $this->shareManager->method('newShare')->willReturn($share); $this->shareManager->method('createShare')->will($this->returnArgument(0)); $this->request ->method('getParam') - ->will($this->returnValueMap([ - ['path', null, 'valid-path'], - ['permissions', null, \OCP\Constants::PERMISSION_ALL], - ['shareType', '-1', Share::SHARE_TYPE_GROUP], - ['shareWith', null, $shareWith], - ])); - - $userFolder = $this->createMock('\OCP\Files\Folder'); + ->willReturnMap([ + ['path', null, 'valid-path'], + ['permissions', null, \OCP\Constants::PERMISSION_ALL], + ['shareType', '-1', \OC\Share\Constants::SHARE_TYPE_GROUP], + ['shareWith', null, $shareWith], + ['expireDate', '', ''], + ]); + + $userFolder = $this->createMock(Folder::class); $this->rootFolder->expects($this->once()) ->method('getUserFolder') ->with('currentUser') ->willReturn($userFolder); - $path = $this->createMock('\OCP\Files\File'); - $storage = $this->createMock('OCP\Files\Storage'); + $path = $this->createMock(File::class); + $storage = $this->createMock(\OCP\Files\Storage::class); $storage->method('instanceOfStorage') - ->with('OCA\Files_Sharing\External\Storage') + ->with(\OCA\Files_Sharing\External\Storage::class) ->willReturn(false); $path->method('getStorage')->willReturn($storage); $userFolder->expects($this->once()) @@ -979,28 +986,29 @@ public function testCreateShareGroupNoValidShareWith($shareWith) { $this->assertEquals($expected->getData(), $result->getData()); } - public function testCreateShareGroupBlacklisted() { + public function testCreateShareGroupBlacklisted(): void { $share = $this->newShare(); $this->shareManager->method('newShare')->willReturn($share); $this->request->method('getParam') - ->will($this->returnValueMap([ + ->willReturnMap([ ['path', null, 'valid-path'], ['permissions', null, \OCP\Constants::PERMISSION_ALL], - ['shareType', '-1', Share::SHARE_TYPE_GROUP], + ['shareType', '-1', \OC\Share\Constants::SHARE_TYPE_GROUP], ['shareWith', null, 'validGroup'], - ])); + ['expireDate', '', ''], + ]); - $userFolder = $this->createMock('\OCP\Files\Folder'); + $userFolder = $this->createMock(Folder::class); $this->rootFolder->expects($this->once()) ->method('getUserFolder') ->with('currentUser') ->willReturn($userFolder); - $path = $this->createMock('\OCP\Files\Folder'); - $storage = $this->createMock('OCP\Files\Storage'); + $path = $this->createMock(Folder::class); + $storage = $this->createMock(\OCP\Files\Storage::class); $storage->method('instanceOfStorage') - ->with('OCA\Files_Sharing\External\Storage') + ->with(\OCA\Files_Sharing\External\Storage::class) ->willReturn(false); $path->method('getStorage')->willReturn($storage); $userFolder->expects($this->once()) @@ -1027,7 +1035,7 @@ public function testCreateShareGroupBlacklisted() { $this->assertEquals($expected->getData(), $result->getData()); } - public function testCreateShareGroup() { + public function testCreateShareGroup(): void { $share = $this->newShare(); $this->shareManager->method('newShare')->willReturn($share); @@ -1035,23 +1043,24 @@ public function testCreateShareGroup() { $this->request ->method('getParam') - ->will($this->returnValueMap([ + ->willReturnMap([ ['path', null, 'valid-path'], ['permissions', null, \OCP\Constants::PERMISSION_ALL], - ['shareType', '-1', Share::SHARE_TYPE_GROUP], + ['shareType', '-1', \OC\Share\Constants::SHARE_TYPE_GROUP], ['shareWith', null, 'validGroup'], - ])); + ['expireDate', '', ''], + ]); - $userFolder = $this->createMock('\OCP\Files\Folder'); + $userFolder = $this->createMock(Folder::class); $this->rootFolder->expects($this->once()) ->method('getUserFolder') ->with('currentUser') ->willReturn($userFolder); - $path = $this->createMock('\OCP\Files\Folder'); - $storage = $this->createMock('OCP\Files\Storage'); + $path = $this->createMock(Folder::class); + $storage = $this->createMock(\OCP\Files\Storage::class); $storage->method('instanceOfStorage') - ->with('OCA\Files_Sharing\External\Storage') + ->with(\OCA\Files_Sharing\External\Storage::class) ->willReturn(false); $path->method('getStorage')->willReturn($storage); $userFolder->expects($this->once()) @@ -1076,10 +1085,10 @@ public function testCreateShareGroup() { ->with(ILockingProvider::LOCK_SHARED); $this->shareManager->method('createShare') - ->with($this->callback(function (\OCP\Share\IShare $share) use ($path) { + ->with($this->callback(function (IShare $share) use ($path) { return $share->getNode() === $path && $share->getPermissions() === \OCP\Constants::PERMISSION_ALL && - $share->getShareType() === Share::SHARE_TYPE_GROUP && + $share->getShareType() === \OC\Share\Constants::SHARE_TYPE_GROUP && $share->getSharedWith() === 'validGroup' && $share->getSharedBy() === 'currentUser'; })) @@ -1094,29 +1103,30 @@ public function testCreateShareGroup() { $this->assertEquals($expected->getData(), $result->getData()); } - public function testCreateShareGroupNotAllowed() { + public function testCreateShareGroupNotAllowed(): void { $share = $this->newShare(); $this->shareManager->method('newShare')->willReturn($share); $this->request ->method('getParam') - ->will($this->returnValueMap([ + ->willReturnMap([ ['path', null, 'valid-path'], ['permissions', null, \OCP\Constants::PERMISSION_ALL], - ['shareType', '-1', Share::SHARE_TYPE_GROUP], + ['shareType', '-1', \OC\Share\Constants::SHARE_TYPE_GROUP], ['shareWith', null, 'validGroup'], - ])); + ['expireDate', '', ''], + ]); - $userFolder = $this->createMock('\OCP\Files\Folder'); + $userFolder = $this->createMock(Folder::class); $this->rootFolder->expects($this->once()) ->method('getUserFolder') ->with('currentUser') ->willReturn($userFolder); - $path = $this->createMock('\OCP\Files\Folder'); - $storage = $this->createMock('OCP\Files\Storage'); + $path = $this->createMock(Folder::class); + $storage = $this->createMock(\OCP\Files\Storage::class); $storage->method('instanceOfStorage') - ->with('OCA\Files_Sharing\External\Storage') + ->with(\OCA\Files_Sharing\External\Storage::class) ->willReturn(false); $path->method('getStorage')->willReturn($storage); $userFolder->expects($this->once()) @@ -1138,18 +1148,19 @@ public function testCreateShareGroupNotAllowed() { $this->assertEquals($expected->getData(), $result->getData()); } - public function testCreateShareLinkNoLinksAllowed() { + public function testCreateShareLinkNoLinksAllowed(): void { $this->request ->method('getParam') - ->will($this->returnValueMap([ + ->willReturnMap([ ['path', null, 'valid-path'], - ['shareType', '-1', Share::SHARE_TYPE_LINK], - ])); + ['shareType', '-1', \OC\Share\Constants::SHARE_TYPE_LINK], + ['expireDate', '', ''], + ]); - $path = $this->createMock('\OCP\Files\Folder'); - $storage = $this->createMock('OCP\Files\Storage'); + $path = $this->createMock(Folder::class); + $storage = $this->createMock(\OCP\Files\Storage::class); $storage->method('instanceOfStorage') - ->with('OCA\Files_Sharing\External\Storage') + ->with(\OCA\Files_Sharing\External\Storage::class) ->willReturn(false); $path->method('getStorage')->willReturn($storage); $this->rootFolder->method('getUserFolder')->with($this->currentUser->getUID())->will($this->returnSelf()); @@ -1164,19 +1175,20 @@ public function testCreateShareLinkNoLinksAllowed() { $this->assertEquals($expected->getData(), $result->getData()); } - public function testCreateShareLinkNoPublicUpload() { + public function testCreateShareLinkNoPublicUpload(): void { $this->request ->method('getParam') - ->will($this->returnValueMap([ + ->willReturnMap([ ['path', null, 'valid-path'], - ['shareType', '-1', Share::SHARE_TYPE_LINK], + ['shareType', '-1', \OC\Share\Constants::SHARE_TYPE_LINK], ['publicUpload', null, 'true'], - ])); + ['expireDate', '', ''], + ]); - $path = $this->createMock('\OCP\Files\Folder'); - $storage = $this->createMock('OCP\Files\Storage'); + $path = $this->createMock(Folder::class); + $storage = $this->createMock(\OCP\Files\Storage::class); $storage->method('instanceOfStorage') - ->with('OCA\Files_Sharing\External\Storage') + ->with(\OCA\Files_Sharing\External\Storage::class) ->willReturn(false); $path->method('getStorage')->willReturn($storage); $this->rootFolder->method('getUserFolder')->with($this->currentUser->getUID())->will($this->returnSelf()); @@ -1192,19 +1204,20 @@ public function testCreateShareLinkNoPublicUpload() { $this->assertEquals($expected->getData(), $result->getData()); } - public function testCreateShareLinkNotInAllowlist() { + public function testCreateShareLinkNotInAllowlist(): void { $this->request ->method('getParam') - ->will($this->returnValueMap([ + ->willReturnMap([ ['path', null, 'valid-path'], - ['shareType', '-1', Share::SHARE_TYPE_LINK], + ['shareType', '-1', \OC\Share\Constants::SHARE_TYPE_LINK], ['publicUpload', null, 'true'], - ])); + ['expireDate', '', ''], + ]); - $path = $this->createMock('\OCP\Files\Folder'); - $storage = $this->createMock('OCP\Files\Storage'); + $path = $this->createMock(Folder::class); + $storage = $this->createMock(\OCP\Files\Storage::class); $storage->method('instanceOfStorage') - ->with('OCA\Files_Sharing\External\Storage') + ->with(\OCA\Files_Sharing\External\Storage::class) ->willReturn(false); $path->method('getStorage')->willReturn($storage); $this->rootFolder->method('getUserFolder')->with($this->currentUser->getUID())->will($this->returnSelf()); @@ -1224,19 +1237,20 @@ public function testCreateShareLinkNotInAllowlist() { $this->assertEquals($expected->getData(), $result->getData()); } - public function testCreateShareLinkPublicUploadFile() { + public function testCreateShareLinkPublicUploadFile(): void { $this->request ->method('getParam') - ->will($this->returnValueMap([ + ->willReturnMap([ ['path', null, 'valid-path'], - ['shareType', '-1', Share::SHARE_TYPE_LINK], + ['shareType', '-1', \OC\Share\Constants::SHARE_TYPE_LINK], ['publicUpload', null, 'true'], - ])); + ['expireDate', '', ''], + ]); - $path = $this->createMock('\OCP\Files\File'); - $storage = $this->createMock('OCP\Files\Storage'); + $path = $this->createMock(File::class); + $storage = $this->createMock(\OCP\Files\Storage::class); $storage->method('instanceOfStorage') - ->with('OCA\Files_Sharing\External\Storage') + ->with(\OCA\Files_Sharing\External\Storage::class) ->willReturn(false); $path->method('getStorage')->willReturn($storage); $this->rootFolder->method('getUserFolder')->with($this->currentUser->getUID())->will($this->returnSelf()); @@ -1253,23 +1267,23 @@ public function testCreateShareLinkPublicUploadFile() { $this->assertEquals($expected->getData(), $result->getData()); } - public function testCreateShareLinkPublicUploadFolder() { + public function testCreateShareLinkPublicUploadFolder(): void { $ocs = $this->mockFormatShare(); $this->request ->method('getParam') - ->will($this->returnValueMap([ + ->willReturnMap([ ['path', null, 'valid-path'], - ['shareType', '-1', Share::SHARE_TYPE_LINK], + ['shareType', '-1', \OC\Share\Constants::SHARE_TYPE_LINK], ['publicUpload', null, 'true'], ['expireDate', '', ''], ['password', '', ''], - ])); + ]); - $path = $this->createMock('\OCP\Files\Folder'); - $storage = $this->createMock('OCP\Files\Storage'); + $path = $this->createMock(Folder::class); + $storage = $this->createMock(\OCP\Files\Storage::class); $storage->method('instanceOfStorage') - ->with('OCA\Files_Sharing\External\Storage') + ->with(\OCA\Files_Sharing\External\Storage::class) ->willReturn(false); $path->method('getStorage')->willReturn($storage); $this->rootFolder->method('getUserFolder')->with($this->currentUser->getUID())->will($this->returnSelf()); @@ -1280,9 +1294,9 @@ public function testCreateShareLinkPublicUploadFolder() { $this->shareManager->method('shareApiLinkAllowPublicUpload')->willReturn(true); $this->shareManager->expects($this->once())->method('createShare')->with( - $this->callback(function (\OCP\Share\IShare $share) use ($path) { + $this->callback(function (IShare $share) use ($path) { return $share->getNode() === $path && - $share->getShareType() === Share::SHARE_TYPE_LINK && + $share->getShareType() === \OC\Share\Constants::SHARE_TYPE_LINK && $share->getPermissions() === (\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_CREATE | \OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_DELETE) && $share->getSharedBy() === 'currentUser' && $share->getPassword() === null && @@ -1297,23 +1311,23 @@ public function testCreateShareLinkPublicUploadFolder() { $this->assertEquals($expected->getData(), $result->getData()); } - public function testCreateShareLinkReadWritePermissions() { + public function testCreateShareLinkReadWritePermissions(): void { $ocs = $this->mockFormatShare(); $this->request ->method('getParam') - ->will($this->returnValueMap([ + ->willReturnMap([ ['path', null, 'valid-path'], - ['shareType', '-1', Share::SHARE_TYPE_LINK], + ['shareType', '-1', \OC\Share\Constants::SHARE_TYPE_LINK], ['permissions', null, '15'], ['expireDate', '', ''], ['password', '', ''], - ])); + ]); - $path = $this->createMock('\OCP\Files\Folder'); - $storage = $this->createMock('OCP\Files\Storage'); + $path = $this->createMock(Folder::class); + $storage = $this->createMock(\OCP\Files\Storage::class); $storage->method('instanceOfStorage') - ->with('OCA\Files_Sharing\External\Storage') + ->with(\OCA\Files_Sharing\External\Storage::class) ->willReturn(false); $path->method('getStorage')->willReturn($storage); $this->rootFolder->method('getUserFolder')->with($this->currentUser->getUID())->will($this->returnSelf()); @@ -1324,9 +1338,9 @@ public function testCreateShareLinkReadWritePermissions() { $this->shareManager->method('shareApiLinkAllowPublicUpload')->willReturn(true); $this->shareManager->expects($this->once())->method('createShare')->with( - $this->callback(function (\OCP\Share\IShare $share) use ($path) { + $this->callback(function (IShare $share) use ($path) { return $share->getNode() === $path && - $share->getShareType() === Share::SHARE_TYPE_LINK && + $share->getShareType() === \OC\Share\Constants::SHARE_TYPE_LINK && $share->getPermissions() === (\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_CREATE | \OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_DELETE) && $share->getSharedBy() === 'currentUser' && $share->getPassword() === null && @@ -1341,23 +1355,23 @@ public function testCreateShareLinkReadWritePermissions() { $this->assertEquals($expected->getData(), $result->getData()); } - public function testCreateShareLinkCreateOnlyFolder() { + public function testCreateShareLinkCreateOnlyFolder(): void { $ocs = $this->mockFormatShare(); $this->request ->method('getParam') - ->will($this->returnValueMap([ + ->willReturnMap([ ['path', null, 'valid-path'], - ['shareType', '-1', Share::SHARE_TYPE_LINK], + ['shareType', '-1', \OC\Share\Constants::SHARE_TYPE_LINK], ['permissions', null, '4'], ['expireDate', '', ''], ['password', '', ''], - ])); + ]); - $path = $this->createMock('\OCP\Files\Folder'); - $storage = $this->createMock('OCP\Files\Storage'); + $path = $this->createMock(Folder::class); + $storage = $this->createMock(\OCP\Files\Storage::class); $storage->method('instanceOfStorage') - ->with('OCA\Files_Sharing\External\Storage') + ->with(\OCA\Files_Sharing\External\Storage::class) ->willReturn(false); $path->method('getStorage')->willReturn($storage); $this->rootFolder->method('getUserFolder')->with($this->currentUser->getUID())->will($this->returnSelf()); @@ -1368,9 +1382,9 @@ public function testCreateShareLinkCreateOnlyFolder() { $this->shareManager->method('shareApiLinkAllowPublicUpload')->willReturn(true); $this->shareManager->expects($this->once())->method('createShare')->with( - $this->callback(function (\OCP\Share\IShare $share) use ($path) { + $this->callback(function (IShare $share) use ($path) { return $share->getNode() === $path && - $share->getShareType() === Share::SHARE_TYPE_LINK && + $share->getShareType() === \OC\Share\Constants::SHARE_TYPE_LINK && $share->getPermissions() === (\OCP\Constants::PERMISSION_CREATE) && $share->getSharedBy() === 'currentUser' && $share->getPassword() === null && @@ -1385,23 +1399,23 @@ public function testCreateShareLinkCreateOnlyFolder() { $this->assertEquals($expected->getData(), $result->getData()); } - public function testCreateShareLinkCreateOnlyFolderPublicUploadDisabled() { + public function testCreateShareLinkCreateOnlyFolderPublicUploadDisabled(): void { $ocs = $this->mockFormatShare(); $this->request ->method('getParam') - ->will($this->returnValueMap([ + ->willReturnMap([ ['path', null, 'valid-path'], - ['shareType', '-1', Share::SHARE_TYPE_LINK], + ['shareType', '-1', \OC\Share\Constants::SHARE_TYPE_LINK], ['permissions', null, '4'], ['expireDate', '', ''], ['password', '', ''], - ])); + ]); - $path = $this->createMock('\OCP\Files\Folder'); - $storage = $this->createMock('OCP\Files\Storage'); + $path = $this->createMock(Folder::class); + $storage = $this->createMock(\OCP\Files\Storage::class); $storage->method('instanceOfStorage') - ->with('OCA\Files_Sharing\External\Storage') + ->with(\OCA\Files_Sharing\External\Storage::class) ->willReturn(false); $path->method('getStorage')->willReturn($storage); $this->rootFolder->method('getUserFolder')->with($this->currentUser->getUID())->will($this->returnSelf()); @@ -1418,22 +1432,22 @@ public function testCreateShareLinkCreateOnlyFolderPublicUploadDisabled() { $this->assertEquals($expected->getData(), $result->getData()); } - public function testCreateShareLinkDefaultPerms() { + public function testCreateShareLinkDefaultPerms(): void { $ocs = $this->mockFormatShare(); $this->request ->method('getParam') - ->will($this->returnValueMap([ + ->willReturnMap([ ['path', null, 'valid-path'], - ['shareType', '-1', Share::SHARE_TYPE_LINK], + ['shareType', '-1', \OC\Share\Constants::SHARE_TYPE_LINK], ['expireDate', '', ''], ['password', '', ''], - ])); + ]); - $path = $this->createMock('\OCP\Files\Folder'); - $storage = $this->createMock('OCP\Files\Storage'); + $path = $this->createMock(Folder::class); + $storage = $this->createMock(\OCP\Files\Storage::class); $storage->method('instanceOfStorage') - ->with('OCA\Files_Sharing\External\Storage') + ->with(\OCA\Files_Sharing\External\Storage::class) ->willReturn(false); $path->method('getStorage')->willReturn($storage); $this->rootFolder->method('getUserFolder')->with($this->currentUser->getUID())->will($this->returnSelf()); @@ -1444,9 +1458,9 @@ public function testCreateShareLinkDefaultPerms() { $this->shareManager->method('shareApiLinkAllowPublicUpload')->willReturn(false); $this->shareManager->expects($this->once())->method('createShare')->with( - $this->callback(function (\OCP\Share\IShare $share) use ($path) { + $this->callback(function (IShare $share) use ($path) { return $share->getNode() === $path && - $share->getShareType() === Share::SHARE_TYPE_LINK && + $share->getShareType() === \OC\Share\Constants::SHARE_TYPE_LINK && $share->getPermissions() === (\OCP\Constants::PERMISSION_READ) && $share->getSharedBy() === 'currentUser' && $share->getPassword() === null && @@ -1461,23 +1475,23 @@ public function testCreateShareLinkDefaultPerms() { $this->assertEquals($expected->getData(), $result->getData()); } - public function testCreateShareLinkPassword() { + public function testCreateShareLinkPassword(): void { $ocs = $this->mockFormatShare(); $this->request ->method('getParam') - ->will($this->returnValueMap([ + ->willReturnMap([ ['path', null, 'valid-path'], - ['shareType', '-1', Share::SHARE_TYPE_LINK], + ['shareType', '-1', \OC\Share\Constants::SHARE_TYPE_LINK], ['publicUpload', null, 'false'], ['expireDate', '', ''], ['password', '', 'password'], - ])); + ]); - $path = $this->createMock('\OCP\Files\Folder'); - $storage = $this->createMock('OCP\Files\Storage'); + $path = $this->createMock(Folder::class); + $storage = $this->createMock(\OCP\Files\Storage::class); $storage->method('instanceOfStorage') - ->with('OCA\Files_Sharing\External\Storage') + ->with(\OCA\Files_Sharing\External\Storage::class) ->willReturn(false); $path->method('getStorage')->willReturn($storage); $this->rootFolder->method('getUserFolder')->with($this->currentUser->getUID())->will($this->returnSelf()); @@ -1488,9 +1502,9 @@ public function testCreateShareLinkPassword() { $this->shareManager->method('shareApiLinkAllowPublicUpload')->willReturn(true); $this->shareManager->expects($this->once())->method('createShare')->with( - $this->callback(function (\OCP\Share\IShare $share) use ($path) { + $this->callback(function (IShare $share) use ($path) { return $share->getNode() === $path && - $share->getShareType() === Share::SHARE_TYPE_LINK && + $share->getShareType() === \OC\Share\Constants::SHARE_TYPE_LINK && $share->getPermissions() === \OCP\Constants::PERMISSION_READ && $share->getSharedBy() === 'currentUser' && $share->getPassword() === 'password' && @@ -1509,30 +1523,31 @@ public function testCreateShareLinkPassword() { * @dataProvider InvalidShareWithProvider * @param mixed $shareWith */ - public function testCreateShareRemoteNoValidShareWith($shareWith) { + public function testCreateShareRemoteNoValidShareWith($shareWith): void { $share = $this->newShare(); $this->shareManager->method('newShare')->willReturn($share); $this->shareManager->method('outgoingServer2ServerSharesAllowed')->willReturn(true); $this->request ->method('getParam') - ->will($this->returnValueMap([ + ->willReturnMap([ ['path', null, 'valid-path'], ['permissions', null, \OCP\Constants::PERMISSION_ALL], - ['shareType', '-1', Share::SHARE_TYPE_REMOTE], - ['shareWith', $this->any(), $shareWith] - ])); + ['shareType', '-1', \OC\Share\Constants::SHARE_TYPE_REMOTE], + ['shareWith', $this->any(), $shareWith], + ['expireDate', '', ''], + ]); - $userFolder = $this->createMock('\OCP\Files\Folder'); + $userFolder = $this->createMock(Folder::class); $this->rootFolder->expects($this->once()) ->method('getUserFolder') ->with('currentUser') ->willReturn($userFolder); - $path = $this->createMock('\OCP\Files\File'); - $storage = $this->createMock('OCP\Files\Storage'); + $path = $this->createMock(File::class); + $storage = $this->createMock(\OCP\Files\Storage::class); $storage->method('instanceOfStorage') - ->with('OCA\Files_Sharing\External\Storage') + ->with(\OCA\Files_Sharing\External\Storage::class) ->willReturn(false); $path->method('getStorage')->willReturn($storage); $userFolder->expects($this->once()) @@ -1551,23 +1566,23 @@ public function testCreateShareRemoteNoValidShareWith($shareWith) { $this->assertEquals($expected->getData(), $result->getData()); } - public function testCreateShareValidExpireDate() { + public function testCreateShareValidExpireDate(): void { $ocs = $this->mockFormatShare(); $this->request ->method('getParam') - ->will($this->returnValueMap([ + ->willReturnMap([ ['path', null, 'valid-path'], - ['shareType', '-1', Share::SHARE_TYPE_LINK], + ['shareType', '-1', \OC\Share\Constants::SHARE_TYPE_LINK], ['publicUpload', null, 'false'], ['expireDate', '', '2000-01-01'], ['password', '', ''], - ])); + ]); - $path = $this->createMock('\OCP\Files\Folder'); - $storage = $this->createMock('OCP\Files\Storage'); + $path = $this->createMock(Folder::class); + $storage = $this->createMock(\OCP\Files\Storage::class); $storage->method('instanceOfStorage') - ->with('OCA\Files_Sharing\External\Storage') + ->with(\OCA\Files_Sharing\External\Storage::class) ->willReturn(false); $path->method('getStorage')->willReturn($storage); $this->rootFolder->method('getUserFolder')->with($this->currentUser->getUID())->will($this->returnSelf()); @@ -1578,12 +1593,12 @@ public function testCreateShareValidExpireDate() { $this->shareManager->method('shareApiLinkAllowPublicUpload')->willReturn(true); $this->shareManager->expects($this->once())->method('createShare')->with( - $this->callback(function (\OCP\Share\IShare $share) use ($path) { + $this->callback(function (IShare $share) use ($path) { $date = new \DateTime('2000-01-01'); $date->setTime(0, 0, 0); return $share->getNode() === $path && - $share->getShareType() === Share::SHARE_TYPE_LINK && + $share->getShareType() === \OC\Share\Constants::SHARE_TYPE_LINK && $share->getPermissions() === \OCP\Constants::PERMISSION_READ && $share->getSharedBy() === 'currentUser' && $share->getPassword() === null && @@ -1598,23 +1613,23 @@ public function testCreateShareValidExpireDate() { $this->assertEquals($expected->getData(), $result->getData()); } - public function testCreateShareInvalidExpireDate() { + public function testCreateShareInvalidExpireDate(): void { $ocs = $this->mockFormatShare(); $this->request ->method('getParam') - ->will($this->returnValueMap([ + ->willReturnMap([ ['path', null, 'valid-path'], - ['shareType', '-1', Share::SHARE_TYPE_LINK], + ['shareType', '-1', \OC\Share\Constants::SHARE_TYPE_LINK], ['publicUpload', null, 'false'], ['expireDate', '', 'a1b2d3'], ['password', '', ''], - ])); + ]); - $path = $this->createMock('\OCP\Files\Folder'); - $storage = $this->createMock('OCP\Files\Storage'); + $path = $this->createMock(Folder::class); + $storage = $this->createMock(\OCP\Files\Storage::class); $storage->method('instanceOfStorage') - ->with('OCA\Files_Sharing\External\Storage') + ->with(\OCA\Files_Sharing\External\Storage::class) ->willReturn(false); $path->method('getStorage')->willReturn($storage); $this->rootFolder->method('getUserFolder')->with($this->currentUser->getUID())->will($this->returnSelf()); @@ -1635,7 +1650,7 @@ public function testCreateShareInvalidExpireDate() { * Test for https://github.com/owncloud/core/issues/22587 * TODO: Remove once proper solution is in place */ - public function testCreateReshareOfFederatedMountNoDeletePermissions() { + public function testCreateReshareOfFederatedMountNoDeletePermissions(): void { $share = \OC::$server->getShareManager()->newShare(); $this->shareManager->method('newShare')->willReturn($share); @@ -1643,23 +1658,24 @@ public function testCreateReshareOfFederatedMountNoDeletePermissions() { $this->request ->method('getParam') - ->will($this->returnValueMap([ + ->willReturnMap([ ['path', null, 'valid-path'], ['permissions', null, \OCP\Constants::PERMISSION_ALL], - ['shareType', $this->any(), Share::SHARE_TYPE_USER], + ['shareType', $this->any(), \OC\Share\Constants::SHARE_TYPE_USER], ['shareWith', null, 'validUser'], - ])); + ['expireDate', '', ''], + ]); - $userFolder = $this->createMock('\OCP\Files\Folder'); + $userFolder = $this->createMock(Folder::class); $this->rootFolder->expects($this->once()) ->method('getUserFolder') ->with('currentUser') ->willReturn($userFolder); - $path = $this->createMock('\OCP\Files\Folder'); - $storage = $this->createMock('OCP\Files\Storage'); + $path = $this->createMock(Folder::class); + $storage = $this->createMock(\OCP\Files\Storage::class); $storage->method('instanceOfStorage') - ->with('OCA\Files_Sharing\External\Storage') + ->with(\OCA\Files_Sharing\External\Storage::class) ->willReturn(true); $path->method('getStorage')->willReturn($storage); $path->method('getPermissions')->willReturn(\OCP\Constants::PERMISSION_READ); @@ -1673,7 +1689,7 @@ public function testCreateReshareOfFederatedMountNoDeletePermissions() { $this->shareManager ->expects($this->once()) ->method('createShare') - ->with($this->callback(function (\OCP\Share\IShare $share) { + ->with($this->callback(function (IShare $share) { return $share->getPermissions() === \OCP\Constants::PERMISSION_READ; })) ->will($this->returnArgument(0)); @@ -1681,8 +1697,8 @@ public function testCreateReshareOfFederatedMountNoDeletePermissions() { $ocs->createShare(); } - public function testUpdateShareCantChange() { - $node = $this->createMock('\OCP\Files\Folder'); + public function testUpdateShareCantChange(): void { + $node = $this->createMock(Folder::class); $share = $this->newShare(); $share->setNode($node); @@ -1699,12 +1715,12 @@ public function testUpdateShareCantChange() { $this->assertEquals($expected->getData(), $result->getData()); } - public function testUpdateNoParametersLink() { - $node = $this->createMock('\OCP\Files\Folder'); + public function testUpdateNoParametersLink(): void { + $node = $this->createMock(Folder::class); $share = $this->newShare(); $share->setPermissions(\OCP\Constants::PERMISSION_ALL) ->setSharedBy($this->currentUser->getUID()) - ->setShareType(Share::SHARE_TYPE_LINK) + ->setShareType(\OC\Share\Constants::SHARE_TYPE_LINK) ->setNode($node); $node->expects($this->once()) @@ -1720,20 +1736,20 @@ public function testUpdateNoParametersLink() { $this->assertEquals($expected->getData(), $result->getData()); } - public function testUpdateNoParametersOther() { + public function testUpdateNoParametersOther(): void { $ocs = $this->mockFormatShare(); - $node = $this->createMock('\OCP\Files\Folder'); + $node = $this->createMock(Folder::class); $share = $this->newShare(); $share->setPermissions(\OCP\Constants::PERMISSION_ALL) ->setSharedBy($this->currentUser->getUID()) - ->setShareType(Share::SHARE_TYPE_GROUP) + ->setShareType(\OC\Share\Constants::SHARE_TYPE_GROUP) ->setNode($node); $this->shareManager->method('getShareById')->with('ocinternal:42')->willReturn($share); $this->shareManager->expects($this->once())->method('updateShare')->with( - $this->callback(function (\OCP\Share\IShare $share) { + $this->callback(function (IShare $share) { return $share->getPermissions() === \OCP\Constants::PERMISSION_ALL && $share->getPassword() === null && $share->getExpirationDate() === null; @@ -1748,7 +1764,7 @@ public function testUpdateNoParametersOther() { $this->assertEquals($expected->getData(), $result->getData()); } - public function testUpdateLinkShareClear() { + public function testUpdateLinkShareClear(): void { $userFolder = $this->createMock(Folder::class); $userFolder->method('getById')->willReturn([]); $this->rootFolder @@ -1757,12 +1773,12 @@ public function testUpdateLinkShareClear() { $ocs = $this->mockFormatShare(); - $node = $this->createMock('\OCP\Files\Folder'); + $node = $this->createMock(Folder::class); $share = $this->newShare(); $share->setPermissions(\OCP\Constants::PERMISSION_ALL) ->setSharedBy($this->currentUser->getUID()) ->setShareOwner($this->currentUser->getUID()) - ->setShareType(Share::SHARE_TYPE_LINK) + ->setShareType(\OC\Share\Constants::SHARE_TYPE_LINK) ->setPassword('password') ->setExpirationDate(new \DateTime()) ->setPermissions(\OCP\Constants::PERMISSION_ALL) @@ -1777,16 +1793,16 @@ public function testUpdateLinkShareClear() { $this->request ->method('getParam') - ->will($this->returnValueMap([ + ->willReturnMap([ ['publicUpload', null, 'false'], ['expireDate', null, ''], ['password', null, ''], - ])); + ]); $this->shareManager->method('getShareById')->with('ocinternal:42')->willReturn($share); $this->shareManager->expects($this->once())->method('updateShare')->with( - $this->callback(function (\OCP\Share\IShare $share) { + $this->callback(function (IShare $share) { return $share->getPermissions() === \OCP\Constants::PERMISSION_READ && $share->getPassword() === null && $share->getExpirationDate() === null; @@ -1800,7 +1816,7 @@ public function testUpdateLinkShareClear() { $this->assertEquals($expected->getData(), $result->getData()); } - public function testUpdateLinkShareSet() { + public function testUpdateLinkShareSet(): void { $userFolder = $this->createMock(Folder::class); $userFolder->method('getById')->willReturn([]); $this->rootFolder @@ -1809,28 +1825,28 @@ public function testUpdateLinkShareSet() { $ocs = $this->mockFormatShare(); - $folder = $this->createMock('\OCP\Files\Folder'); + $folder = $this->createMock(Folder::class); $share = \OC::$server->getShareManager()->newShare(); $share->setPermissions(\OCP\Constants::PERMISSION_ALL) ->setSharedBy($this->currentUser->getUID()) ->setShareOwner($this->currentUser->getUID()) - ->setShareType(Share::SHARE_TYPE_LINK) + ->setShareType(\OC\Share\Constants::SHARE_TYPE_LINK) ->setNode($folder); $this->request ->method('getParam') - ->will($this->returnValueMap([ + ->willReturnMap([ ['publicUpload', null, 'true'], ['expireDate', null, '2000-01-01'], ['password', null, 'password'], - ])); + ]); $this->shareManager->method('getShareById')->with('ocinternal:42')->willReturn($share); $this->shareManager->method('shareApiLinkAllowPublicUpload')->willReturn(true); $this->shareManager->expects($this->once())->method('updateShare')->with( - $this->callback(function (\OCP\Share\IShare $share) { + $this->callback(function (IShare $share) { $date = new \DateTime('2000-01-01'); $date->setTime(0, 0, 0); @@ -1850,7 +1866,7 @@ public function testUpdateLinkShareSet() { /** * @dataProvider publicUploadParamsProvider */ - public function testUpdateLinkShareEnablePublicUpload($params) { + public function testUpdateLinkShareEnablePublicUpload($params): void { $userFolder = $this->createMock(Folder::class); $userFolder->method('getById')->willReturn([]); $this->rootFolder @@ -1859,35 +1875,35 @@ public function testUpdateLinkShareEnablePublicUpload($params) { $ocs = $this->mockFormatShare(); - $folder = $this->createMock('\OCP\Files\Folder'); + $folder = $this->createMock(Folder::class); $share = \OC::$server->getShareManager()->newShare(); $share->setPermissions(\OCP\Constants::PERMISSION_ALL) ->setSharedBy($this->currentUser->getUID()) ->setShareOwner($this->currentUser->getUID()) - ->setShareType(Share::SHARE_TYPE_LINK) + ->setShareType(\OC\Share\Constants::SHARE_TYPE_LINK) ->setPassword('password') ->setNode($folder); $this->request ->method('getParam') - ->will($this->returnValueMap($params)); + ->willReturnMap($params); $this->shareManager->method('getShareById')->with('ocinternal:42')->willReturn($share); $this->shareManager->method('shareApiLinkAllowPublicUpload')->willReturn(true); $this->shareManager->method('getSharedWith')->willReturn([]); $this->shareManager->expects($this->once())->method('updateShare')->with( - $this->callback(function (\OCP\Share\IShare $share) { + $this->callback(function (IShare $share) { if ($share->getPermissions() === (\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_CREATE | \OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_DELETE)) { return $share->getPermissions() === (\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_CREATE | \OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_DELETE) && $share->getPassword() === 'password' && $share->getExpirationDate() === null; - } else { - return $share->getPermissions() === (\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_CREATE | \OCP\Constants::PERMISSION_UPDATE) && - $share->getPassword() === 'password' && - $share->getExpirationDate() === null; } + + return $share->getPermissions() === (\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_CREATE | \OCP\Constants::PERMISSION_UPDATE) && + $share->getPassword() === 'password' && + $share->getExpirationDate() === null; }) )->will($this->returnArgument(0)); @@ -1898,7 +1914,7 @@ public function testUpdateLinkShareEnablePublicUpload($params) { $this->assertEquals($expected->getData(), $result->getData()); } - public function testUpdateLinkShareInvalidDate() { + public function testUpdateLinkShareInvalidDate(): void { $userFolder = $this->createMock(Folder::class); $userFolder->method('getById')->willReturn([]); $this->rootFolder @@ -1907,21 +1923,21 @@ public function testUpdateLinkShareInvalidDate() { $ocs = $this->mockFormatShare(); - $folder = $this->createMock('\OCP\Files\Folder'); + $folder = $this->createMock(Folder::class); $share = \OC::$server->getShareManager()->newShare(); $share->setPermissions(\OCP\Constants::PERMISSION_ALL) ->setSharedBy($this->currentUser->getUID()) - ->setShareType(Share::SHARE_TYPE_LINK) + ->setShareType(\OC\Share\Constants::SHARE_TYPE_LINK) ->setNode($folder); $this->request ->method('getParam') - ->will($this->returnValueMap([ + ->willReturnMap([ ['publicUpload', null, 'true'], ['expireDate', null, '2000-01-a'], ['password', null, 'password'], - ])); + ]); $this->shareManager->method('getShareById')->with('ocinternal:42')->willReturn($share); $this->shareManager->method('shareApiLinkAllowPublicUpload')->willReturn(true); @@ -1933,7 +1949,7 @@ public function testUpdateLinkShareInvalidDate() { $this->assertEquals($expected->getData(), $result->getData()); } - public function publicUploadParamsProvider() { + public function publicUploadParamsProvider(): array { return [ [[ ['publicUpload', null, 'true'], @@ -1956,20 +1972,20 @@ public function publicUploadParamsProvider() { /** * @dataProvider publicUploadParamsProvider */ - public function testUpdateLinkSharePublicUploadNotAllowed($params) { + public function testUpdateLinkSharePublicUploadNotAllowed($params): void { $ocs = $this->mockFormatShare(); - $folder = $this->createMock('\OCP\Files\Folder'); + $folder = $this->createMock(Folder::class); $share = \OC::$server->getShareManager()->newShare(); $share->setPermissions(\OCP\Constants::PERMISSION_ALL) ->setSharedBy($this->currentUser->getUID()) - ->setShareType(Share::SHARE_TYPE_LINK) + ->setShareType(\OC\Share\Constants::SHARE_TYPE_LINK) ->setNode($folder); $this->request ->method('getParam') - ->will($this->returnValueMap($params)); + ->willReturnMap($params); $this->shareManager->method('getShareById')->with('ocinternal:42')->willReturn($share); $this->shareManager->method('shareApiLinkAllowPublicUpload')->willReturn(false); @@ -1981,24 +1997,24 @@ public function testUpdateLinkSharePublicUploadNotAllowed($params) { $this->assertEquals($expected->getData(), $result->getData()); } - public function testUpdateLinkSharePublicUploadOnFile() { + public function testUpdateLinkSharePublicUploadOnFile(): void { $ocs = $this->mockFormatShare(); - $file = $this->createMock('\OCP\Files\File'); + $file = $this->createMock(File::class); $share = \OC::$server->getShareManager()->newShare(); $share->setPermissions(\OCP\Constants::PERMISSION_ALL) ->setSharedBy($this->currentUser->getUID()) - ->setShareType(Share::SHARE_TYPE_LINK) + ->setShareType(\OC\Share\Constants::SHARE_TYPE_LINK) ->setNode($file); $this->request ->method('getParam') - ->will($this->returnValueMap([ + ->willReturnMap([ ['publicUpload', null, 'true'], ['expireDate', '', ''], ['password', '', 'password'], - ])); + ]); $this->shareManager->method('getShareById')->with('ocinternal:42')->willReturn($share); $this->shareManager->method('shareApiLinkAllowPublicUpload')->willReturn(true); @@ -2010,17 +2026,17 @@ public function testUpdateLinkSharePublicUploadOnFile() { $this->assertEquals($expected->getData(), $result->getData()); } - public function testUpdateLinkSharePasswordDoesNotChangeOther() { + public function testUpdateLinkSharePasswordDoesNotChangeOther(): void { $ocs = $this->mockFormatShare(); $date = new \DateTime('2000-01-01'); $date->setTime(0, 0, 0); - $node = $this->createMock('\OCP\Files\File'); + $node = $this->createMock(File::class); $share = $this->newShare(); $share->setPermissions(\OCP\Constants::PERMISSION_ALL) ->setSharedBy($this->currentUser->getUID()) - ->setShareType(Share::SHARE_TYPE_LINK) + ->setShareType(\OC\Share\Constants::SHARE_TYPE_LINK) ->setPassword('password') ->setExpirationDate($date) ->setPermissions(\OCP\Constants::PERMISSION_ALL) @@ -2035,14 +2051,14 @@ public function testUpdateLinkSharePasswordDoesNotChangeOther() { $this->request ->method('getParam') - ->will($this->returnValueMap([ + ->willReturnMap([ ['password', null, 'newpassword'], - ])); + ]); $this->shareManager->method('getShareById')->with('ocinternal:42')->willReturn($share); $this->shareManager->expects($this->once())->method('updateShare')->with( - $this->callback(function (\OCP\Share\IShare $share) use ($date) { + $this->callback(function (IShare $share) use ($date) { return $share->getPermissions() === \OCP\Constants::PERMISSION_ALL && $share->getPassword() === 'newpassword' && $share->getExpirationDate() === $date; @@ -2056,14 +2072,14 @@ public function testUpdateLinkSharePasswordDoesNotChangeOther() { $this->assertEquals($expected->getData(), $result->getData()); } - public function testUpdateLinkShareExpireDateDoesNotChangeOther() { + public function testUpdateLinkShareExpireDateDoesNotChangeOther(): void { $ocs = $this->mockFormatShare(); - $node = $this->createMock('\OCP\Files\File'); + $node = $this->createMock(File::class); $share = $this->newShare(); $share->setPermissions(\OCP\Constants::PERMISSION_ALL) ->setSharedBy($this->currentUser->getUID()) - ->setShareType(Share::SHARE_TYPE_LINK) + ->setShareType(\OC\Share\Constants::SHARE_TYPE_LINK) ->setPassword('password') ->setExpirationDate(new \DateTime()) ->setPermissions(\OCP\Constants::PERMISSION_ALL) @@ -2071,9 +2087,9 @@ public function testUpdateLinkShareExpireDateDoesNotChangeOther() { $this->request ->method('getParam') - ->will($this->returnValueMap([ + ->willReturnMap([ ['expireDate', null, '2010-12-23'], - ])); + ]); $node->expects($this->once()) ->method('lock') @@ -2085,7 +2101,7 @@ public function testUpdateLinkShareExpireDateDoesNotChangeOther() { $this->shareManager->method('getShareById')->with('ocinternal:42')->willReturn($share); $this->shareManager->expects($this->once())->method('updateShare')->with( - $this->callback(function (\OCP\Share\IShare $share) { + $this->callback(function (IShare $share) { $date = new \DateTime('2010-12-23'); $date->setTime(0, 0, 0); @@ -2102,7 +2118,7 @@ public function testUpdateLinkShareExpireDateDoesNotChangeOther() { $this->assertEquals($expected->getData(), $result->getData()); } - public function testUpdateLinkSharePublicUploadDoesNotChangeOther() { + public function testUpdateLinkSharePublicUploadDoesNotChangeOther(): void { $userFolder = $this->createMock(Folder::class); $userFolder->method('getById')->willReturn([]); $this->rootFolder @@ -2113,13 +2129,13 @@ public function testUpdateLinkSharePublicUploadDoesNotChangeOther() { $date = new \DateTime('2000-01-01'); - $folder = $this->createMock('\OCP\Files\Folder'); + $folder = $this->createMock(Folder::class); $share = \OC::$server->getShareManager()->newShare(); $share->setPermissions(\OCP\Constants::PERMISSION_ALL) ->setSharedBy($this->currentUser->getUID()) ->setShareOwner($this->currentUser->getUID()) - ->setShareType(Share::SHARE_TYPE_LINK) + ->setShareType(\OC\Share\Constants::SHARE_TYPE_LINK) ->setPassword('password') ->setExpirationDate($date) ->setPermissions(\OCP\Constants::PERMISSION_ALL) @@ -2127,15 +2143,15 @@ public function testUpdateLinkSharePublicUploadDoesNotChangeOther() { $this->request ->method('getParam') - ->will($this->returnValueMap([ + ->willReturnMap([ ['publicUpload', null, 'true'], - ])); + ]); $this->shareManager->method('getShareById')->with('ocinternal:42')->willReturn($share); $this->shareManager->method('shareApiLinkAllowPublicUpload')->willReturn(true); $this->shareManager->expects($this->once())->method('updateShare')->with( - $this->callback(function (\OCP\Share\IShare $share) use ($date) { + $this->callback(function (IShare $share) use ($date) { return $share->getPermissions() === (\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_CREATE | \OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_DELETE) && $share->getPassword() === 'password' && $share->getExpirationDate() === $date; @@ -2149,7 +2165,7 @@ public function testUpdateLinkSharePublicUploadDoesNotChangeOther() { $this->assertEquals($expected->getData(), $result->getData()); } - public function testUpdateLinkSharePermissions() { + public function testUpdateLinkSharePermissions(): void { $userFolder = $this->createMock(Folder::class); $userFolder->method('getById')->willReturn([]); $this->rootFolder @@ -2160,12 +2176,12 @@ public function testUpdateLinkSharePermissions() { $date = new \DateTime('2000-01-01'); - $folder = $this->createMock('\OCP\Files\Folder'); + $folder = $this->createMock(Folder::class); $share = \OC::$server->getShareManager()->newShare(); $share->setPermissions(\OCP\Constants::PERMISSION_ALL) ->setSharedBy($this->currentUser->getUID()) - ->setShareType(Share::SHARE_TYPE_LINK) + ->setShareType(\OC\Share\Constants::SHARE_TYPE_LINK) ->setPassword('password') ->setExpirationDate($date) ->setPermissions(\OCP\Constants::PERMISSION_ALL) @@ -2173,15 +2189,15 @@ public function testUpdateLinkSharePermissions() { $this->request ->method('getParam') - ->will($this->returnValueMap([ + ->willReturnMap([ ['permissions', null, '7'], - ])); + ]); $this->shareManager->method('getShareById')->with('ocinternal:42')->willReturn($share); $this->shareManager->method('shareApiLinkAllowPublicUpload')->willReturn(true); $this->shareManager->expects($this->once())->method('updateShare')->with( - $this->callback(function (\OCP\Share\IShare $share) use ($date) { + $this->callback(function (IShare $share) use ($date) { return $share->getPermissions() === (\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_CREATE | \OCP\Constants::PERMISSION_UPDATE) && $share->getPassword() === 'password' && $share->getExpirationDate() === $date; @@ -2197,7 +2213,7 @@ public function testUpdateLinkSharePermissions() { $this->assertEquals($expected->getData(), $result->getData()); } - public function testUpdateLinkShareCreateOnly() { + public function testUpdateLinkShareCreateOnly(): void { $userFolder = $this->createMock(Folder::class); $userFolder->method('getById')->willReturn([]); $this->rootFolder @@ -2206,26 +2222,26 @@ public function testUpdateLinkShareCreateOnly() { $ocs = $this->mockFormatShare(); - $folder = $this->createMock('\OCP\Files\Folder'); + $folder = $this->createMock(Folder::class); $share = \OC::$server->getShareManager()->newShare(); $share->setPermissions(\OCP\Constants::PERMISSION_ALL) ->setSharedBy($this->currentUser->getUID()) - ->setShareType(Share::SHARE_TYPE_LINK) + ->setShareType(\OC\Share\Constants::SHARE_TYPE_LINK) ->setPermissions(\OCP\Constants::PERMISSION_READ) ->setNode($folder); $this->request ->method('getParam') - ->will($this->returnValueMap([ + ->willReturnMap([ ['permissions', null, '4'], - ])); + ]); $this->shareManager->method('getShareById')->with('ocinternal:42')->willReturn($share); $this->shareManager->method('shareApiLinkAllowPublicUpload')->willReturn(true); $this->shareManager->expects($this->once())->method('updateShare')->with( - $this->callback(function (\OCP\Share\IShare $share) { + $this->callback(function (IShare $share) { return $share->getPermissions() === \OCP\Constants::PERMISSION_CREATE; }) )->will($this->returnArgument(0)); @@ -2239,17 +2255,17 @@ public function testUpdateLinkShareCreateOnly() { $this->assertEquals($expected->getData(), $result->getData()); } - public function testUpdateLinkShareInvalidPermissions() { + public function testUpdateLinkShareInvalidPermissions(): void { $ocs = $this->mockFormatShare(); $date = new \DateTime('2000-01-01'); - $folder = $this->createMock('\OCP\Files\Folder'); + $folder = $this->createMock(Folder::class); $share = \OC::$server->getShareManager()->newShare(); $share->setPermissions(\OCP\Constants::PERMISSION_ALL) ->setSharedBy($this->currentUser->getUID()) - ->setShareType(Share::SHARE_TYPE_LINK) + ->setShareType(\OC\Share\Constants::SHARE_TYPE_LINK) ->setPassword('password') ->setExpirationDate($date) ->setPermissions(\OCP\Constants::PERMISSION_ALL) @@ -2257,9 +2273,9 @@ public function testUpdateLinkShareInvalidPermissions() { $this->request ->method('getParam') - ->will($this->returnValueMap([ + ->willReturnMap([ ['permissions', null, '31'], - ])); + ]); $this->shareManager->method('getShareById')->with('ocinternal:42')->willReturn($share); $this->shareManager->method('shareApiLinkAllowPublicUpload')->willReturn(true); @@ -2271,28 +2287,28 @@ public function testUpdateLinkShareInvalidPermissions() { $this->assertEquals($expected->getData(), $result->getData()); } - public function testUpdateOtherPermissions() { + public function testUpdateOtherPermissions(): void { $ocs = $this->mockFormatShare(); - $file = $this->createMock('\OCP\Files\File'); + $file = $this->createMock(File::class); $share = \OC::$server->getShareManager()->newShare(); $share->setPermissions(\OCP\Constants::PERMISSION_ALL) ->setSharedBy($this->currentUser->getUID()) - ->setShareType(Share::SHARE_TYPE_USER) + ->setShareType(\OC\Share\Constants::SHARE_TYPE_USER) ->setNode($file); $this->request ->method('getParam') - ->will($this->returnValueMap([ + ->willReturnMap([ ['permissions', null, '31'], - ])); + ]); $this->shareManager->method('getShareById')->with('ocinternal:42')->willReturn($share); $this->shareManager->method('shareApiLinkAllowPublicUpload')->willReturn(true); $this->shareManager->expects($this->once())->method('updateShare')->with( - $this->callback(function (\OCP\Share\IShare $share) { + $this->callback(function (IShare $share) { return $share->getPermissions() === \OCP\Constants::PERMISSION_ALL; }) )->will($this->returnArgument(0)); @@ -2306,30 +2322,30 @@ public function testUpdateOtherPermissions() { $this->assertEquals($expected->getData(), $result->getData()); } - public function testUpdateLinkShareNameAlone() { + public function testUpdateLinkShareNameAlone(): void { $ocs = $this->mockFormatShare(); $date = new \DateTime('2000-01-01'); - $folder = $this->createMock('\OCP\Files\Folder'); + $folder = $this->createMock(Folder::class); $share = \OC::$server->getShareManager()->newShare(); $share->setPermissions(\OCP\Constants::PERMISSION_READ) ->setSharedBy($this->currentUser->getUID()) - ->setShareType(Share::SHARE_TYPE_LINK) + ->setShareType(\OC\Share\Constants::SHARE_TYPE_LINK) ->setName('somename') ->setNode($folder); $this->request ->method('getParam') - ->will($this->returnValueMap([ + ->willReturnMap([ ['name', null, 'another'], - ])); + ]); $this->shareManager->method('getShareById')->with('ocinternal:42')->willReturn($share); $this->shareManager->expects($this->once())->method('updateShare')->with( - $this->callback(function (\OCP\Share\IShare $share) use ($date) { + $this->callback(function (IShare $share) use ($date) { return $share->getName() === 'another'; }) )->will($this->returnArgument(0)); @@ -2343,30 +2359,30 @@ public function testUpdateLinkShareNameAlone() { $this->assertEquals($expected->getData(), $result->getData()); } - public function testUpdateLinkShareKeepNameWhenNotSpecified() { + public function testUpdateLinkShareKeepNameWhenNotSpecified(): void { $ocs = $this->mockFormatShare(); $date = new \DateTime('2000-01-01'); - $folder = $this->createMock('\OCP\Files\Folder'); + $folder = $this->createMock(Folder::class); $share = \OC::$server->getShareManager()->newShare(); $share->setPermissions(\OCP\Constants::PERMISSION_READ) ->setSharedBy($this->currentUser->getUID()) - ->setShareType(Share::SHARE_TYPE_LINK) + ->setShareType(\OC\Share\Constants::SHARE_TYPE_LINK) ->setName('somename') ->setNode($folder); $this->request ->method('getParam') - ->will($this->returnValueMap([ + ->willReturnMap([ ['password', null, 'test'], - ])); + ]); $this->shareManager->method('getShareById')->with('ocinternal:42')->willReturn($share); $this->shareManager->expects($this->once())->method('updateShare')->with( - $this->callback(function (\OCP\Share\IShare $share) use ($date) { + $this->callback(function (IShare $share) use ($date) { return $share->getPermissions() === (\OCP\Constants::PERMISSION_READ) && $share->getPassword() === 'test' && $share->getName() === 'somename'; @@ -2382,10 +2398,10 @@ public function testUpdateLinkShareKeepNameWhenNotSpecified() { $this->assertEquals($expected->getData(), $result->getData()); } - private function getMockFileFolder() { - $file = $this->createMock('\OCP\Files\File'); - $folder = $this->createMock('\OCP\Files\Folder'); - $parent = $this->createMock('\OCP\Files\Folder'); + private function getMockFileFolder(): array { + $file = $this->createMock(File::class); + $folder = $this->createMock(Folder::class); + $parent = $this->createMock(Folder::class); $file->method('getMimeType')->willReturn('myMimeType'); $folder->method('getMimeType')->willReturn('myFolderMimeType'); @@ -2400,9 +2416,9 @@ private function getMockFileFolder() { $file->method('getParent')->willReturn($parent); $folder->method('getParent')->willReturn($parent); - $cache = $this->createMock('OCP\Files\Cache\ICache'); + $cache = $this->createMock(ICache::class); $cache->method('getNumericStorageId')->willReturn(100); - $storage = $this->createMock('\OCP\Files\Storage'); + $storage = $this->createMock(\OCP\Files\Storage::class); $storage->method('getId')->willReturn('storageId'); $storage->method('getCache')->willReturn($cache); @@ -2412,20 +2428,20 @@ private function getMockFileFolder() { return [$file, $folder]; } - public function dataFormatShare() { - list($file, $folder) = $this->getMockFileFolder(); - $owner = $this->createMock('\OCP\IUser'); + public function dataFormatShare(): array { + [$file, $folder] = $this->getMockFileFolder(); + $owner = $this->createMock(IUser::class); $owner->method('getDisplayName')->willReturn('ownerDN'); - $initiator = $this->createMock('\OCP\IUser'); + $initiator = $this->createMock(IUser::class); $initiator->method('getDisplayName')->willReturn('initiatorDN'); - $recipient = $this->createMock('\OCP\IUser'); + $recipient = $this->createMock(IUser::class); $recipient->method('getDisplayName')->willReturn('recipientDN'); - list($shareAttributes, $shareAttributesReturnJson) = $this->mockShareAttributes(); + [$shareAttributes, $shareAttributesReturnJson] = $this->mockShareAttributes(); $result = []; $share = \OC::$server->getShareManager()->newShare(); - $share->setShareType(Share::SHARE_TYPE_USER) + $share->setShareType(\OC\Share\Constants::SHARE_TYPE_USER) ->setSharedWith('recipient') ->setSharedBy('initiator') ->setShareOwner('owner') @@ -2440,7 +2456,7 @@ public function dataFormatShare() { $result[] = [ [ 'id' => 42, - 'share_type' => Share::SHARE_TYPE_USER, + 'share_type' => \OC\Share\Constants::SHARE_TYPE_USER, 'uid_owner' => 'initiator', 'displayname_owner' => 'initiator', 'share_with_user_type' => Constants::USER_TYPE_USER, @@ -2471,7 +2487,7 @@ public function dataFormatShare() { $result[] = [ [ 'id' => 42, - 'share_type' => Share::SHARE_TYPE_USER, + 'share_type' => \OC\Share\Constants::SHARE_TYPE_USER, 'uid_owner' => 'initiator', 'displayname_owner' => 'initiatorDN', 'share_with_user_type' => Constants::USER_TYPE_USER, @@ -2506,7 +2522,7 @@ public function dataFormatShare() { ]; $share = \OC::$server->getShareManager()->newShare(); - $share->setShareType(Share::SHARE_TYPE_USER) + $share->setShareType(\OC\Share\Constants::SHARE_TYPE_USER) ->setSharedWith('recipient') ->setSharedBy('initiator') ->setShareOwner('owner') @@ -2520,7 +2536,7 @@ public function dataFormatShare() { $result[] = [ [ 'id' => 42, - 'share_type' => Share::SHARE_TYPE_USER, + 'share_type' => \OC\Share\Constants::SHARE_TYPE_USER, 'share_with_user_type' => Constants::USER_TYPE_USER, 'uid_owner' => 'initiator', 'displayname_owner' => 'initiator', @@ -2549,7 +2565,7 @@ public function dataFormatShare() { // with existing group $share = \OC::$server->getShareManager()->newShare(); - $share->setShareType(Share::SHARE_TYPE_GROUP) + $share->setShareType(\OC\Share\Constants::SHARE_TYPE_GROUP) ->setSharedWith('recipientGroup') ->setSharedBy('initiator') ->setShareOwner('owner') @@ -2562,7 +2578,7 @@ public function dataFormatShare() { $result[] = [ [ 'id' => 42, - 'share_type' => Share::SHARE_TYPE_GROUP, + 'share_type' => \OC\Share\Constants::SHARE_TYPE_GROUP, 'uid_owner' => 'initiator', 'displayname_owner' => 'initiator', 'permissions' => 1, @@ -2590,7 +2606,7 @@ public function dataFormatShare() { // with unknown group / no group backend $share = \OC::$server->getShareManager()->newShare(); - $share->setShareType(Share::SHARE_TYPE_GROUP) + $share->setShareType(\OC\Share\Constants::SHARE_TYPE_GROUP) ->setSharedWith('recipientGroup2') ->setSharedBy('initiator') ->setShareOwner('owner') @@ -2602,7 +2618,7 @@ public function dataFormatShare() { $result[] = [ [ 'id' => 42, - 'share_type' => Share::SHARE_TYPE_GROUP, + 'share_type' => \OC\Share\Constants::SHARE_TYPE_GROUP, 'uid_owner' => 'initiator', 'displayname_owner' => 'initiator', 'permissions' => 1, @@ -2629,7 +2645,7 @@ public function dataFormatShare() { ]; $share = \OC::$server->getShareManager()->newShare(); - $share->setShareType(Share::SHARE_TYPE_LINK) + $share->setShareType(\OC\Share\Constants::SHARE_TYPE_LINK) ->setSharedBy('initiator') ->setShareOwner('owner') ->setPermissions(\OCP\Constants::PERMISSION_READ) @@ -2645,7 +2661,7 @@ public function dataFormatShare() { $result[] = [ [ 'id' => 42, - 'share_type' => Share::SHARE_TYPE_LINK, + 'share_type' => \OC\Share\Constants::SHARE_TYPE_LINK, 'uid_owner' => 'initiator', 'displayname_owner' => 'initiator', 'permissions' => 1, @@ -2674,7 +2690,7 @@ public function dataFormatShare() { ]; $share = \OC::$server->getShareManager()->newShare(); - $share->setShareType(Share::SHARE_TYPE_REMOTE) + $share->setShareType(\OC\Share\Constants::SHARE_TYPE_REMOTE) ->setSharedBy('initiator') ->setSharedWith('user@server.com') ->setShareOwner('owner') @@ -2687,7 +2703,7 @@ public function dataFormatShare() { $result[] = [ [ 'id' => 42, - 'share_type' => Share::SHARE_TYPE_REMOTE, + 'share_type' => \OC\Share\Constants::SHARE_TYPE_REMOTE, 'uid_owner' => 'initiator', 'displayname_owner' => 'initiator', 'permissions' => 1, @@ -2714,7 +2730,7 @@ public function dataFormatShare() { ]; $share = \OC::$server->getShareManager()->newShare(); - $share->setShareType(Share::SHARE_TYPE_USER) + $share->setShareType(\OC\Share\Constants::SHARE_TYPE_USER) ->setSharedBy('initiator') ->setSharedWith('recipient') ->setShareOwner('owner') @@ -2734,18 +2750,18 @@ public function dataFormatShare() { * @dataProvider dataFormatShare * * @param array $expects - * @param \OCP\Share\IShare $share + * @param IShare $share * @param array $users * @param $exception */ - public function testFormatShare(array $expects, \OCP\Share\IShare $share, array $users, $exception) { - $this->userManager->method('get')->will($this->returnValueMap($users)); + public function testFormatShare(array $expects, IShare $share, array $users, $exception): void { + $this->userManager->method('get')->willReturnMap($users); - $recipientGroup = $this->createMock('\OCP\IGroup'); + $recipientGroup = $this->createMock(IGroup::class); $recipientGroup->method('getDisplayName')->willReturn('recipientGroupDisplayName'); - $this->groupManager->method('get')->will($this->returnValueMap([ - ['recipientGroup', $recipientGroup], - ])); + $this->groupManager->method('get')->willReturnMap([ + ['recipientGroup', $recipientGroup], + ]); $this->urlGenerator->method('linkToRouteAbsolute') ->with('files_sharing.sharecontroller.showShare', ['token' => 'myToken']) @@ -2777,12 +2793,11 @@ public function testFormatShare(array $expects, \OCP\Share\IShare $share, array /** * @return Share20OcsController */ - public function getOcsDisabledAPI() { - $shareManager = $this->getMockBuilder('OCP\Share\IManager') + public function getOcsDisabledAPI(): Share20OcsController { + $shareManager = $this->getMockBuilder(IManager::class) ->disableOriginalConstructor() ->getMock(); $shareManager - ->expects($this->any()) ->method('shareApiEnabled') ->willReturn(false); @@ -2805,7 +2820,7 @@ public function getOcsDisabledAPI() { ); } - public function testGetShareApiDisabled() { + public function testGetShareApiDisabled(): void { $ocs = $this->getOcsDisabledAPI(); $expected = new Result(null, 404, 'Share API is disabled'); @@ -2814,7 +2829,7 @@ public function testGetShareApiDisabled() { $this->assertEquals($expected, $result); } - public function testDeleteShareApiDisabled() { + public function testDeleteShareApiDisabled(): void { $ocs = $this->getOcsDisabledAPI(); $expected = new Result(null, 404, 'Share API is disabled'); @@ -2823,7 +2838,7 @@ public function testDeleteShareApiDisabled() { $this->assertEquals($expected, $result); } - public function testCreateShareApiDisabled() { + public function testCreateShareApiDisabled(): void { $ocs = $this->getOcsDisabledAPI(); $expected = new Result(null, 404, 'Share API is disabled'); @@ -2832,7 +2847,7 @@ public function testCreateShareApiDisabled() { $this->assertEquals($expected, $result); } - public function testGetSharesApiDisabled() { + public function testGetSharesApiDisabled(): void { $ocs = $this->getOcsDisabledAPI(); $expected = new Result(); @@ -2841,7 +2856,7 @@ public function testGetSharesApiDisabled() { $this->assertEquals($expected, $result); } - public function testUpdateShareApiDisabled() { + public function testUpdateShareApiDisabled(): void { $ocs = $this->getOcsDisabledAPI(); $expected = new Result(null, 404, 'Share API is disabled'); @@ -2850,7 +2865,7 @@ public function testUpdateShareApiDisabled() { $this->assertEquals($expected, $result); } - public function additionalInfoDataProvider() { + public function additionalInfoDataProvider(): array { return [ ['', null, null, null], ['unsupported', null, null, null], @@ -2862,13 +2877,13 @@ public function additionalInfoDataProvider() { /** * @dataProvider additionalInfoDataProvider */ - public function testGetShareAdditionalInfo($configValue, $expectedInfo, $expectedOwnerInfo, $expectedInitiatorInfo) { + public function testGetShareAdditionalInfo($configValue, $expectedInfo, $expectedOwnerInfo, $expectedInitiatorInfo): void { $config = $this->createMock(IConfig::class); $config->method('getAppValue') - ->will($this->returnValueMap([ + ->willReturnMap([ ['core', 'shareapi_default_permissions', \OCP\Constants::PERMISSION_ALL, \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_CREATE], ['core', 'user_additional_info_field', '', $configValue], - ])); + ]); $initiator = $this->createMock(IUser::class); $initiator->method('getUID')->willReturn('initiator_id'); @@ -2882,11 +2897,11 @@ public function testGetShareAdditionalInfo($configValue, $expectedInfo, $expecte $recipient->method('getUID')->willReturn('recipient_id'); $recipient->method('getEMailAddress')->willReturn('email@example.com'); - $this->userManager->method('get')->will($this->returnValueMap([ + $this->userManager->method('get')->willReturnMap([ ['initiator', false, $initiator], ['recipient', false, $recipient], ['owner', false, $owner], - ])); + ]); $ocs = new Share20OcsController( 'files_sharing', @@ -2906,10 +2921,10 @@ public function testGetShareAdditionalInfo($configValue, $expectedInfo, $expecte $this->userTypeHelper ); - list($file, ) = $this->getMockFileFolder(); + [$file,] = $this->getMockFileFolder(); $share = \OC::$server->getShareManager()->newShare(); - $share->setShareType(Share::SHARE_TYPE_USER) + $share->setShareType(\OC\Share\Constants::SHARE_TYPE_USER) ->setSharedWith('recipient') ->setSharedBy('initiator') ->setShareOwner('owner') @@ -2938,7 +2953,7 @@ public function testGetShareAdditionalInfo($configValue, $expectedInfo, $expecte $this->assertEquals($expectedInitiatorInfo, $result['additional_info_owner']); } - public function providesGetSharesAll() { + public function providesGetSharesAll(): array { return [ [ null, @@ -2968,25 +2983,25 @@ public function providesGetSharesAll() { null, false, false, - [\OCP\Share::SHARE_TYPE_USER, \OCP\Share::SHARE_TYPE_REMOTE], + [\OC\Share\Constants::SHARE_TYPE_USER, \OC\Share\Constants::SHARE_TYPE_REMOTE], ], [ '/requested/path', true, false, - [\OCP\Share::SHARE_TYPE_USER, \OCP\Share::SHARE_TYPE_REMOTE], + [\OC\Share\Constants::SHARE_TYPE_USER, \OC\Share\Constants::SHARE_TYPE_REMOTE], ], [ '/requested/path', false, false, - [\OCP\Share::SHARE_TYPE_USER, \OCP\Share::SHARE_TYPE_REMOTE], + [\OC\Share\Constants::SHARE_TYPE_USER, \OC\Share\Constants::SHARE_TYPE_REMOTE], ], [ '/requested/path', true, true, - [\OCP\Share::SHARE_TYPE_USER, \OCP\Share::SHARE_TYPE_REMOTE], + [\OC\Share\Constants::SHARE_TYPE_USER, \OC\Share\Constants::SHARE_TYPE_REMOTE], ], ]; } @@ -2994,7 +3009,7 @@ public function providesGetSharesAll() { /** * @dataProvider providesGetSharesAll */ - public function testGetSharesAll($requestedPath, $requestedReshares, $fedAllowed, $shareTypes) { + public function testGetSharesAll($requestedPath, $requestedReshares, $fedAllowed, $shareTypes): void { $userShare = $this->newShare(); $groupShare = $this->newShare(); $linkShare = $this->newShare(); @@ -3022,62 +3037,62 @@ public function testGetSharesAll($requestedPath, $requestedReshares, $fedAllowed } $this->shareManager->method('getSharesBy') - ->will($this->returnValueMap([ - ['currentUser', \OCP\Share::SHARE_TYPE_USER, $node, $requestedReshares, -1, 0, [$userShare]], - ['currentUser', \OCP\Share::SHARE_TYPE_GROUP, $node, $requestedReshares, -1, 0, [$groupShare]], - ['currentUser', \OCP\Share::SHARE_TYPE_LINK, $node, $requestedReshares, -1, 0, [$linkShare]], - ['currentUser', \OCP\Share::SHARE_TYPE_REMOTE, $node, $requestedReshares, -1, 0, [$federatedShare]], - ])); + ->willReturnMap([ + ['currentUser', \OC\Share\Constants::SHARE_TYPE_USER, $node, $requestedReshares, -1, 0, [$userShare]], + ['currentUser', \OC\Share\Constants::SHARE_TYPE_GROUP, $node, $requestedReshares, -1, 0, [$groupShare]], + ['currentUser', \OC\Share\Constants::SHARE_TYPE_LINK, $node, $requestedReshares, -1, 0, [$linkShare]], + ['currentUser', \OC\Share\Constants::SHARE_TYPE_REMOTE, $node, $requestedReshares, -1, 0, [$federatedShare]], + ]); $this->request ->method('getParam') - ->will($this->returnValueMap([ + ->willReturnMap([ ['path', null, $requestedPath], ['reshares', null, $requestedReshares ? 'true' : 'false'], ['share_types', '', \implode(',', $shareTypes)], - ])); + ]); $this->shareManager->method('outgoingServer2ServerSharesAllowed')->willReturn($fedAllowed); $ocs = $this->mockFormatShare(); - $ocs->expects($this->any())->method('formatShare')->will($this->returnArgument(0)); + $ocs->expects(self::atLeast(1))->method('formatShare')->will($this->returnArgument(0)); $result = $ocs->getShares(); if (\count($shareTypes) === 0) { $shareTypes = [ - \OCP\Share::SHARE_TYPE_USER, - \OCP\Share::SHARE_TYPE_GROUP, - \OCP\Share::SHARE_TYPE_LINK, - \OCP\Share::SHARE_TYPE_REMOTE, + \OC\Share\Constants::SHARE_TYPE_USER, + \OC\Share\Constants::SHARE_TYPE_GROUP, + \OC\Share\Constants::SHARE_TYPE_LINK, + \OC\Share\Constants::SHARE_TYPE_REMOTE, ]; } foreach ($shareTypes as $shareType) { switch ($shareType) { - case \OCP\Share::SHARE_TYPE_USER: + case \OC\Share\Constants::SHARE_TYPE_USER: $this->assertContains($userShare, $result->getData(), 'result contains user share'); break; - case \OCP\Share::SHARE_TYPE_GROUP: + case \OC\Share\Constants::SHARE_TYPE_GROUP: $this->assertContains($groupShare, $result->getData(), 'result contains group share'); break; - case \OCP\Share::SHARE_TYPE_LINK: + case \OC\Share\Constants::SHARE_TYPE_LINK: $this->assertContains($linkShare, $result->getData(), 'result contains link share'); break; - case \OCP\Share::SHARE_TYPE_REMOTE: + case \OC\Share\Constants::SHARE_TYPE_REMOTE: if ($fedAllowed) { $this->assertContains($federatedShare, $result->getData(), 'result contains federated share'); } break; } } - if ($fedAllowed && \in_array(\OCP\Share::SHARE_TYPE_REMOTE, $shareTypes, true)) { + if ($fedAllowed && \in_array(\OC\Share\Constants::SHARE_TYPE_REMOTE, $shareTypes, true)) { $this->assertCount(\count($shareTypes), $result->getData()); } else { $this->assertCount(\count($shareTypes) - 1, $result->getData()); } } - public function providesGetSharesSharedWithMe() { + public function providesGetSharesSharedWithMe(): array { return [ [ null, @@ -3091,12 +3106,12 @@ public function providesGetSharesSharedWithMe() { ], [ '/requested/path', - \OCP\Share::STATE_PENDING, + \OC\Share\Constants::STATE_PENDING, [], ], [ '/requested/path', - \OCP\Share::STATE_ACCEPTED, + \OC\Share\Constants::STATE_ACCEPTED, [], ], [ @@ -3107,52 +3122,52 @@ public function providesGetSharesSharedWithMe() { [ null, 'all', - [\OCP\Share::SHARE_TYPE_USER], + [\OC\Share\Constants::SHARE_TYPE_USER], ], [ '/requested/path', 'all', - [\OCP\Share::SHARE_TYPE_USER], + [\OC\Share\Constants::SHARE_TYPE_USER], ], [ '/requested/path', - \OCP\Share::STATE_PENDING, - [\OCP\Share::SHARE_TYPE_USER], + \OC\Share\Constants::STATE_PENDING, + [\OC\Share\Constants::SHARE_TYPE_USER], ], [ '/requested/path', - \OCP\Share::STATE_ACCEPTED, - [\OCP\Share::SHARE_TYPE_USER], + \OC\Share\Constants::STATE_ACCEPTED, + [\OC\Share\Constants::SHARE_TYPE_USER], ], [ '/requested/path', '', - [\OCP\Share::SHARE_TYPE_USER], + [\OC\Share\Constants::SHARE_TYPE_USER], ], [ null, 'all', - [\OCP\Share::SHARE_TYPE_GROUP], + [\OC\Share\Constants::SHARE_TYPE_GROUP], ], [ '/requested/path', 'all', - [\OCP\Share::SHARE_TYPE_GROUP], + [\OC\Share\Constants::SHARE_TYPE_GROUP], ], [ '/requested/path', - \OCP\Share::STATE_PENDING, - [\OCP\Share::SHARE_TYPE_GROUP], + \OC\Share\Constants::STATE_PENDING, + [\OC\Share\Constants::SHARE_TYPE_GROUP], ], [ '/requested/path', - \OCP\Share::STATE_ACCEPTED, - [\OCP\Share::SHARE_TYPE_GROUP], + \OC\Share\Constants::STATE_ACCEPTED, + [\OC\Share\Constants::SHARE_TYPE_GROUP], ], [ '/requested/path', '', - [\OCP\Share::SHARE_TYPE_GROUP], + [\OC\Share\Constants::SHARE_TYPE_GROUP], ], ]; } @@ -3160,27 +3175,27 @@ public function providesGetSharesSharedWithMe() { /** * @dataProvider providesGetSharesSharedWithMe */ - public function testGetSharesSharedWithMe($requestedPath, $stateFilter, $shareTypes) { + public function testGetSharesSharedWithMe($requestedPath, $stateFilter, $shareTypes): void { $testStateFilter = $stateFilter; if ($testStateFilter === '' || $testStateFilter === 'all') { - $testStateFilter = \OCP\Share::STATE_ACCEPTED; + $testStateFilter = \OC\Share\Constants::STATE_ACCEPTED; } $userShare = $this->newShare(); $userShare->setShareOwner('shareOwner'); $userShare->setSharedWith('currentUser'); - $userShare->setShareType(\OCP\Share::SHARE_TYPE_USER); + $userShare->setShareType(\OC\Share\Constants::SHARE_TYPE_USER); $userShare->setState($testStateFilter); $userShare->setPermissions(\OCP\Constants::PERMISSION_ALL); $userShareNoAccess = $this->newShare(); $userShareNoAccess->setShareOwner('shareOwner'); $userShareNoAccess->setSharedWith('currentUser'); - $userShareNoAccess->setShareType(\OCP\Share::SHARE_TYPE_USER); + $userShareNoAccess->setShareType(\OC\Share\Constants::SHARE_TYPE_USER); $userShareNoAccess->setState($testStateFilter); $userShareNoAccess->setPermissions(0); $userShareDifferentState = $this->newShare(); $userShareDifferentState->setShareOwner('shareOwner'); $userShareDifferentState->setSharedWith('currentUser'); - $userShareDifferentState->setShareType(\OCP\Share::SHARE_TYPE_USER); + $userShareDifferentState->setShareType(\OC\Share\Constants::SHARE_TYPE_USER); $userShareDifferentState->setState($testStateFilter + 1); $userShareDifferentState->setPermissions(\OCP\Constants::PERMISSION_ALL); $groupShare = $this->newShare(); @@ -3188,15 +3203,15 @@ public function testGetSharesSharedWithMe($requestedPath, $stateFilter, $shareTy $groupShare->setSharedWith('group1'); $groupShare->setState($testStateFilter); $groupShare->setPermissions(\OCP\Constants::PERMISSION_ALL); - $groupShare->setShareType(\OCP\Share::SHARE_TYPE_GROUP); + $groupShare->setShareType(\OC\Share\Constants::SHARE_TYPE_GROUP); $groupShareNonOwner = $this->newShare(); $groupShareNonOwner->setShareOwner('currentUser'); $groupShareNonOwner->setSharedWith('group1'); $groupShareNonOwner->setState($testStateFilter); - $groupShareNonOwner->setShareType(\OCP\Share::SHARE_TYPE_GROUP); + $groupShareNonOwner->setShareType(\OC\Share\Constants::SHARE_TYPE_GROUP); $groupShareNonOwner->setPermissions(\OCP\Constants::PERMISSION_ALL); - $group = $this->createMock('OCP\IGroup'); + $group = $this->createMock(IGroup::class); $group->method('inGroup')->with($this->currentUser)->willReturn(true); $this->groupManager->method('get')->with('group1')->willReturn($group); @@ -3223,43 +3238,43 @@ public function testGetSharesSharedWithMe($requestedPath, $stateFilter, $shareTy } $this->shareManager->method('getSharedWith') - ->will($this->returnValueMap([ - ['currentUser', \OCP\Share::SHARE_TYPE_USER, $node, -1, 0, [$userShare, $userShareDifferentState, $userShareNoAccess]], - ['currentUser', \OCP\Share::SHARE_TYPE_GROUP, $node, -1, 0, [$groupShare, $groupShareNonOwner]], - ])); + ->willReturnMap([ + ['currentUser', \OC\Share\Constants::SHARE_TYPE_USER, $node, -1, 0, [$userShare, $userShareDifferentState, $userShareNoAccess]], + ['currentUser', \OC\Share\Constants::SHARE_TYPE_GROUP, $node, -1, 0, [$groupShare, $groupShareNonOwner]], + ]); $this->request ->method('getParam') - ->will($this->returnValueMap([ + ->willReturnMap([ ['path', null, $requestedPath], - ['state', \OCP\Share::STATE_ACCEPTED, $stateFilter], + ['state', \OC\Share\Constants::STATE_ACCEPTED, $stateFilter], ['shared_with_me', null, 'true'], ['share_types', '', \implode(',', $shareTypes)], - ])); + ]); $ocs = $this->mockFormatShare(); - $ocs->expects($this->any())->method('formatShare')->will($this->returnArgument(0)); + $ocs->expects($this->atLeast(1))->method('formatShare')->will($this->returnArgument(0)); $result = $ocs->getShares(); if (empty($shareTypes)) { $shareTypes = [ - \OCP\Share::SHARE_TYPE_USER, - \OCP\Share::SHARE_TYPE_GROUP, + \OC\Share\Constants::SHARE_TYPE_USER, + \OC\Share\Constants::SHARE_TYPE_GROUP, ]; } - if (\in_array(\OCP\Share::SHARE_TYPE_USER, $shareTypes, true)) { + if (\in_array(\OC\Share\Constants::SHARE_TYPE_USER, $shareTypes, true)) { $this->assertContains($userShare, $result->getData(), 'result contains user share'); $this->assertNotContains($userShareNoAccess, $result->getData(), 'result does not contain inaccessible share'); if ($stateFilter === 'all') { - if (\in_array(\OCP\Share::SHARE_TYPE_GROUP, $shareTypes, true)) { + if (\in_array(\OC\Share\Constants::SHARE_TYPE_GROUP, $shareTypes, true)) { $this->assertCount(3, $result->getData()); } else { $this->assertCount(2, $result->getData()); } $this->assertContains($userShareDifferentState, $result->getData(), 'result contains shares from all states'); } else { - if (\in_array(\OCP\Share::SHARE_TYPE_GROUP, $shareTypes, true)) { + if (\in_array(\OC\Share\Constants::SHARE_TYPE_GROUP, $shareTypes, true)) { $this->assertCount(2, $result->getData()); } else { $this->assertCount(1, $result->getData()); @@ -3268,23 +3283,23 @@ public function testGetSharesSharedWithMe($requestedPath, $stateFilter, $shareTy } } - if (\in_array(\OCP\Share::SHARE_TYPE_GROUP, $shareTypes, true)) { + if (\in_array(\OC\Share\Constants::SHARE_TYPE_GROUP, $shareTypes, true)) { $this->assertContains($groupShare, $result->getData(), 'result contains group share'); $this->assertNotContains($groupShareNonOwner, $result->getData(), 'result does not contain share from same owner'); } } - public function testGetSharesSharedWithMeAndBlockGroup() { + public function testGetSharesSharedWithMeAndBlockGroup(): void { $requestedPath = "/requested/path"; $stateFilter = "all"; $testStateFilter = $stateFilter; if ($testStateFilter === '' || $testStateFilter === 'all') { - $testStateFilter = \OCP\Share::STATE_ACCEPTED; + $testStateFilter = \OC\Share\Constants::STATE_ACCEPTED; } $userShare = $this->newShare(); $userShare->setShareOwner('shareOwner'); $userShare->setSharedWith('currentUser'); - $userShare->setShareType(\OCP\Share::SHARE_TYPE_USER); + $userShare->setShareType(\OC\Share\Constants::SHARE_TYPE_USER); $userShare->setState($testStateFilter); $userShare->setPermissions(\OCP\Constants::PERMISSION_ALL); @@ -3296,10 +3311,10 @@ public function testGetSharesSharedWithMeAndBlockGroup() { ->willReturn(true); $this->groupManager->method('get') - ->will($this->returnValueMap([ + ->willReturnMap([ ['group', $group], ['excluded_group', $groupObj] - ])); + ]); $node = $this->createMock(Node::class); $node->expects($this->once()) @@ -3318,63 +3333,63 @@ public function testGetSharesSharedWithMeAndBlockGroup() { ->willReturn($userFolder); $this->shareManager->method('getSharedWith') - ->will($this->returnValueMap([ - ['currentUser', \OCP\Share::SHARE_TYPE_USER, $node, -1, 0, [$userShare]], - ['currentUser', \OCP\Share::SHARE_TYPE_GROUP, $node, -1, 0, []], - ])); + ->willReturnMap([ + ['currentUser', \OC\Share\Constants::SHARE_TYPE_USER, $node, -1, 0, [$userShare]], + ['currentUser', \OC\Share\Constants::SHARE_TYPE_GROUP, $node, -1, 0, []], + ]); $this->shareManager->method('sharingDisabledForUser') ->with('currentUser') ->willReturn(true); $this->request ->method('getParam') - ->will($this->returnValueMap([ + ->willReturnMap([ ['path', null, $requestedPath], - ['state', \OCP\Share::STATE_ACCEPTED, $stateFilter], + ['state', \OC\Share\Constants::STATE_ACCEPTED, $stateFilter], ['shared_with_me', null, 'true'], ['share_types', '', ''], - ])); + ]); $ocs = $this->mockFormatShare(); - $ocs->expects($this->any())->method('formatShare')->will($this->returnArgument(0)); + $ocs->expects($this->atLeastOnce())->method('formatShare')->will($this->returnArgument(0)); $result = $ocs->getShares(); $this->assertEquals($userShare->getPermissions(), $result->getData()[0]->getPermissions()); } - public function providesAcceptRejectShare() { + public function providesAcceptRejectShare(): array { return [ - ['acceptShare', '/target', true, \OCP\Share::STATE_ACCEPTED], - ['acceptShare', '/sfoo/target', true, \OCP\Share::STATE_ACCEPTED], - ['acceptShare', '/target', false, \OCP\Share::STATE_ACCEPTED], - ['acceptShare', '/sfoo/target', false, \OCP\Share::STATE_ACCEPTED], - ['declineShare', '/target', true, \OCP\Share::STATE_REJECTED], - ['declineShare', '/sfoo/target', true, \OCP\Share::STATE_REJECTED], + ['acceptShare', '/target', true, \OC\Share\Constants::STATE_ACCEPTED], + ['acceptShare', '/sfoo/target', true, \OC\Share\Constants::STATE_ACCEPTED], + ['acceptShare', '/target', false, \OC\Share\Constants::STATE_ACCEPTED], + ['acceptShare', '/sfoo/target', false, \OC\Share\Constants::STATE_ACCEPTED], + ['declineShare', '/target', true, \OC\Share\Constants::STATE_REJECTED], + ['declineShare', '/sfoo/target', true, \OC\Share\Constants::STATE_REJECTED], ]; } /** * @dataProvider providesAcceptRejectShare */ - public function testAcceptRejectShare($method, $target, $targetExists, $expectedState) { + public function testAcceptRejectShare($method, $target, $targetExists, $expectedState): void { $userShare = $this->makeReceivedUserShareForOperation($target); - $this->shareManager->expects($this->exactly(1)) + $this->shareManager->expects($this->once()) ->method('getShareById') ->with('ocinternal:123', 'currentUser') ->willReturn($userShare); $this->shareManager->expects($this->exactly(2)) ->method('getSharedWith') - ->will($this->returnValueMap([ - ['currentUser', Share::SHARE_TYPE_USER, $userShare->getNode(), -1, 0, [$userShare]], - ['currentUser', Share::SHARE_TYPE_GROUP, $userShare->getNode(), -1, 0, []] - ])); + ->willReturnMap([ + ['currentUser', \OC\Share\Constants::SHARE_TYPE_USER, $userShare->getNode(), -1, 0, [$userShare]], + ['currentUser', \OC\Share\Constants::SHARE_TYPE_GROUP, $userShare->getNode(), -1, 0, []] + ]); $this->shareManager->expects($this->once()) ->method('updateShareForRecipient') ->with($userShare, 'currentUser'); - $userFolder = $this->createMock('OCP\Files\Folder'); + $userFolder = $this->createMock(Folder::class); if ($method === 'acceptShare') { // deduplicate if ($targetExists) { @@ -3419,7 +3434,7 @@ public function testAcceptRejectShare($method, $target, $targetExists, $expected ->willReturn($userFolder); $ocs = $this->mockFormatShare(); - $ocs->expects($this->any())->method('formatShare')->will($this->returnArgument(0)); + $ocs->expects($this->atLeastOnce())->method('formatShare')->will($this->returnArgument(0)); $result = $ocs->$method(123); $this->assertEquals(100, $result->getStatusCode()); @@ -3427,31 +3442,31 @@ public function testAcceptRejectShare($method, $target, $targetExists, $expected if ($method === 'acceptShare' && $targetExists) { $this->assertEquals("$target (2)", $userShare->getTarget()); } else { - $this->assertEquals("$target", $userShare->getTarget()); + $this->assertEquals((string)$target, $userShare->getTarget()); } $this->assertSame($expectedState, $userShare->getState()); } - public function providesAcceptRejectShareSameState() { + public function providesAcceptRejectShareSameState(): array { return [ - ['acceptShare', '/target', true, \OCP\Share::STATE_ACCEPTED], - ['declineShare', '/sfoo/target', true, \OCP\Share::STATE_REJECTED], + ['acceptShare', '/target', true, \OC\Share\Constants::STATE_ACCEPTED], + ['declineShare', '/sfoo/target', true, \OC\Share\Constants::STATE_REJECTED], ]; } /** * @dataProvider providesAcceptRejectShareSameState */ - public function testAcceptRejectShareSameState($method, $target) { + public function testAcceptRejectShareSameState($method, $target): void { $userShare = $this->makeReceivedUserShareForOperation($target); - $this->shareManager->expects($this->exactly(1)) + $this->shareManager->expects($this->once()) ->method('getShareById') ->with('ocinternal:123', 'currentUser') ->willReturn($userShare); if ($method === 'acceptShare') { - $userShare->setState(\OCP\Share::STATE_ACCEPTED); + $userShare->setState(\OC\Share\Constants::STATE_ACCEPTED); $this->eventDispatcher->expects($this->exactly(2)) ->method('dispatch') ->withConsecutive( @@ -3459,7 +3474,7 @@ public function testAcceptRejectShareSameState($method, $target) { [$this->equalTo(new GenericEvent(null, ['share' => $userShare])), $this->equalTo('share.afteraccept')] ); } else { - $userShare->setState(\OCP\Share::STATE_REJECTED); + $userShare->setState(\OC\Share\Constants::STATE_REJECTED); $this->eventDispatcher->expects($this->exactly(2)) ->method('dispatch') ->withConsecutive( @@ -3478,32 +3493,32 @@ public function testAcceptRejectShareSameState($method, $target) { /** * @dataProvider providesAcceptRejectShare */ - public function testAcceptRejectShareMultiple($method, $target, $targetExists, $expectedState) { + public function testAcceptRejectShareMultiple($method, $target, $targetExists, $expectedState): void { $userShare = $this->makeReceivedUserShareForOperation($target); $groupShare = $this->newShare(); $groupShare->setId(234); - $groupShare->setShareType(Share::SHARE_TYPE_GROUP); + $groupShare->setShareType(\OC\Share\Constants::SHARE_TYPE_GROUP); $groupShare->setSharedWith('group1'); $groupShare->setNode($userShare->getNode()); $groupShare->setTarget($target); - $this->shareManager->expects($this->exactly(1)) + $this->shareManager->expects($this->once()) ->method('getShareById') ->with('ocinternal:123', 'currentUser') ->willReturn($userShare); $this->shareManager->expects($this->exactly(2)) ->method('getSharedWith') - ->will($this->returnValueMap([ - ['currentUser', Share::SHARE_TYPE_USER, $userShare->getNode(), -1, 0, [$userShare]], - ['currentUser', Share::SHARE_TYPE_GROUP, $userShare->getNode(), -1, 0, [$groupShare]] - ])); + ->willReturnMap([ + ['currentUser', \OC\Share\Constants::SHARE_TYPE_USER, $userShare->getNode(), -1, 0, [$userShare]], + ['currentUser', \OC\Share\Constants::SHARE_TYPE_GROUP, $userShare->getNode(), -1, 0, [$groupShare]] + ]); $this->shareManager->expects($this->exactly(2)) ->method('updateShareForRecipient') ->withConsecutive([$userShare], [$groupShare]); - $userFolder = $this->createMock('OCP\Files\Folder'); + $userFolder = $this->createMock(Folder::class); if ($method === 'acceptShare') { // deduplicate if ($targetExists) { @@ -3548,7 +3563,7 @@ public function testAcceptRejectShareMultiple($method, $target, $targetExists, $ ->willReturn($userFolder); $ocs = $this->mockFormatShare(); - $ocs->expects($this->any())->method('formatShare')->will($this->returnArgument(0)); + $ocs->expects($this->atLeastOnce())->method('formatShare')->will($this->returnArgument(0)); $result = $ocs->$method(123); $this->assertEquals(100, $result->getStatusCode()); @@ -3556,7 +3571,7 @@ public function testAcceptRejectShareMultiple($method, $target, $targetExists, $ if ($method === 'acceptShare' && $targetExists) { $this->assertEquals("$target (2)", $userShare->getTarget()); } else { - $this->assertEquals("$target", $userShare->getTarget()); + $this->assertEquals((string)$target, $userShare->getTarget()); } $this->assertSame($expectedState, $userShare->getState()); } @@ -3564,7 +3579,7 @@ public function testAcceptRejectShareMultiple($method, $target, $targetExists, $ /** * @dataProvider providesAcceptRejectShare */ - public function testAcceptRejectShareApiDisabled($method, $target, $targetExists, $expectedState) { + public function testAcceptRejectShareApiDisabled($method, $target, $targetExists): void { $ocs = $this->getOcsDisabledAPI(); $expected = new Result(null, 404, 'Share API is disabled'); @@ -3573,19 +3588,19 @@ public function testAcceptRejectShareApiDisabled($method, $target, $targetExists $this->assertEquals($expected, $result); } - private function makeReceivedUserShareForOperation($target) { + private function makeReceivedUserShareForOperation($target): IShare { $node = $this->createMock(Node::class); - $node->expects($this->any()) + $node->expects($this->atLeastOnce()) ->method('lock'); - $node->expects($this->any()) + $node->expects($this->atLeastOnce()) ->method('unlock'); $userShare = $this->newShare(); $userShare->setId(123); $userShare->setShareOwner('shareOwner'); $userShare->setSharedWith('currentUser'); - $userShare->setShareType(\OCP\Share::SHARE_TYPE_USER); - $userShare->setState(\OCP\Share::STATE_PENDING); + $userShare->setShareType(\OC\Share\Constants::SHARE_TYPE_USER); + $userShare->setState(\OC\Share\Constants::STATE_PENDING); $userShare->setPermissions(\OCP\Constants::PERMISSION_ALL); $userShare->setTarget($target); $userShare->setNode($node); @@ -3596,7 +3611,7 @@ private function makeReceivedUserShareForOperation($target) { /** * @dataProvider providesAcceptRejectShare */ - public function testAcceptRejectShareInvalidId($method, $target, $targetExists, $expectedState) { + public function testAcceptRejectShareInvalidId($method, $target, $targetExists, $expectedState): void { $this->shareManager->expects($this->any()) ->method('getShareById') ->with('ocinternal:123') @@ -3614,7 +3629,7 @@ public function testAcceptRejectShareInvalidId($method, $target, $targetExists, /** * @dataProvider providesAcceptRejectShare */ - public function testAcceptRejectShareAccessDenied($method, $target, $targetExists, $expectedState) { + public function testAcceptRejectShareAccessDenied($method, $target, $targetExists): void { $userShare = $this->makeReceivedUserShareForOperation($target); $userShare->setPermissions(0); @@ -3635,10 +3650,10 @@ public function testAcceptRejectShareAccessDenied($method, $target, $targetExist /** * @dataProvider providesAcceptRejectShare */ - public function testAcceptRejectShareAccessNotRecipient($method, $target, $targetExists, $expectedState) { + public function testAcceptRejectShareAccessNotRecipient($method, $target, $targetExists): void { $userShare = $this->makeReceivedUserShareForOperation($target); - $this->shareManager->expects($this->any()) + $this->shareManager ->method('getShareById') ->with('ocinternal:123', 'currentUser') ->willReturn($userShare); @@ -3664,7 +3679,7 @@ public function testAcceptRejectShareAccessNotRecipient($method, $target, $targe /** * @dataProvider providesAcceptRejectShare */ - public function testAcceptRejectShareOperationError($method, $target, $targetExists, $expectedState) { + public function testAcceptRejectShareOperationError($method, $target, $targetExists): void { $userShare = $this->makeReceivedUserShareForOperation($target); $this->shareManager->expects($this->once()) @@ -3679,8 +3694,8 @@ public function testAcceptRejectShareOperationError($method, $target, $targetExi $this->shareManager->expects($this->exactly(2)) ->method('getSharedWith') ->willReturnMap([ - ['currentUser', Share::SHARE_TYPE_USER, $userShare->getNode(), -1, 0, [$userShare]], - ['currentUser', Share::SHARE_TYPE_GROUP, $userShare->getNode(), -1, 0, []] + ['currentUser', \OC\Share\Constants::SHARE_TYPE_USER, $userShare->getNode(), -1, 0, [$userShare]], + ['currentUser', \OC\Share\Constants::SHARE_TYPE_GROUP, $userShare->getNode(), -1, 0, []] ]); $userFolder = $this->createMock(Folder::class); @@ -3711,7 +3726,7 @@ public function testAcceptRejectShareOperationError($method, $target, $targetExi /** * @dataProvider providesTestAttributes */ - public function testSettingAttributes($attributes, $expectedAttributeObject) { + public function testSettingAttributes($attributes, $expectedAttributeObject): void { $share = $this->newShare(); $this->shareManager->method('newShare')->willReturn($share); @@ -3731,20 +3746,21 @@ public function testSettingAttributes($attributes, $expectedAttributeObject) { ['path', null, 'valid-path'], ['permissions', null, 1], ['attributes', null, $attributes], - ['shareType', $this->any(), Share::SHARE_TYPE_USER], + ['shareType', $this->any(), \OC\Share\Constants::SHARE_TYPE_USER], ['shareWith', null, 'validUser'], + ['expireDate', '', ''] ]); - $userFolder = $this->createMock('\OCP\Files\Folder'); + $userFolder = $this->createMock(Folder::class); $this->rootFolder->expects($this->once()) ->method('getUserFolder') ->with('currentUser') ->willReturn($userFolder); - $path = $this->createMock('\OCP\Files\File'); - $storage = $this->createMock('OCP\Files\Storage'); + $path = $this->createMock(File::class); + $storage = $this->createMock(\OCP\Files\Storage::class); $storage->method('instanceOfStorage') - ->with('OCA\Files_Sharing\External\Storage') + ->with(\OCA\Files_Sharing\External\Storage::class) ->willReturn(false); $path->method('getStorage')->willReturn($storage); $userFolder->expects($this->once()) @@ -3769,7 +3785,7 @@ public function testSettingAttributes($attributes, $expectedAttributeObject) { $this->assertEquals($expectedAttributeObject, $result->getData()['attributes']->toArray()); } - public function providesTestAttributes() { + public function providesTestAttributes(): array { return [ [ [ @@ -3821,7 +3837,7 @@ public function providesTestAttributes() { /** * @dataProvider providesPermissionsViaAttributes */ - public function testPermissionsViaAttributes($expectedPermission, $attributes) { + public function testPermissionsViaAttributes($expectedPermission, $attributes): void { $share = $this->newShare(); $this->shareManager->method('newShare')->willReturn($share); @@ -3841,20 +3857,21 @@ public function testPermissionsViaAttributes($expectedPermission, $attributes) { ['path', null, 'valid-path'], ['permissions', null, null], ['attributes', null, $attributes], - ['shareType', $this->any(), Share::SHARE_TYPE_USER], + ['shareType', $this->any(), \OC\Share\Constants::SHARE_TYPE_USER], ['shareWith', null, 'validUser'], + ['expireDate', '', ''] ]); - $userFolder = $this->createMock('\OCP\Files\Folder'); + $userFolder = $this->createMock(Folder::class); $this->rootFolder->expects($this->once()) ->method('getUserFolder') ->with('currentUser') ->willReturn($userFolder); - $path = $this->createMock('\OCP\Files\File'); - $storage = $this->createMock('OCP\Files\Storage'); + $path = $this->createMock(File::class); + $storage = $this->createMock(\OCP\Files\Storage::class); $storage->method('instanceOfStorage') - ->with('OCA\Files_Sharing\External\Storage') + ->with(\OCA\Files_Sharing\External\Storage::class) ->willReturn(false); $path->method('getStorage')->willReturn($storage); $userFolder->expects($this->once()) @@ -3878,7 +3895,7 @@ public function testPermissionsViaAttributes($expectedPermission, $attributes) { $this->assertEquals($expectedPermission, $result->getData()['permissions']); } - public function providesPermissionsViaAttributes() { + public function providesPermissionsViaAttributes(): array { return [ [ \OCP\Constants::PERMISSION_READ, [ diff --git a/apps/files_sharing/tests/EtagPropagationTest.php b/apps/files_sharing/tests/EtagPropagationTest.php index 2240db0743e1..4478dd5c3888 100644 --- a/apps/files_sharing/tests/EtagPropagationTest.php +++ b/apps/files_sharing/tests/EtagPropagationTest.php @@ -181,7 +181,7 @@ protected function setUpShares() { $this->logout(); } - public function testOwnerWritesToShare() { + public function testOwnerWritesToShare(): void { self::loginAsUser(self::TEST_FILES_SHARING_API_USER1); Filesystem::file_put_contents('/sub1/sub2/folder/asd.txt', 'bar'); $this->assertEtagsNotChanged([self::TEST_FILES_SHARING_API_USER4]); diff --git a/apps/files_sharing/tests/TestCase.php b/apps/files_sharing/tests/TestCase.php index 78e342401b2a..29bacbe45974 100644 --- a/apps/files_sharing/tests/TestCase.php +++ b/apps/files_sharing/tests/TestCase.php @@ -179,12 +179,6 @@ protected static function loginHelper($user, $create = false, $password = false) * reset init status for the share storage */ protected static function resetStorage() { - $storage = new \ReflectionClass(SharedStorage::class); - $isInitialized = $storage->getProperty('initialized'); - $isInitialized->setAccessible(true); - $isInitialized->setValue($storage, false); - $isInitialized->setAccessible(false); - $storage = new \ReflectionClass(Storage::class); $property = $storage->getProperty('localCache'); $property->setAccessible(true); diff --git a/apps/files_trashbin/tests/TestCase.php b/apps/files_trashbin/tests/TestCase.php index 08ac9738006b..a2d6bac970f9 100644 --- a/apps/files_trashbin/tests/TestCase.php +++ b/apps/files_trashbin/tests/TestCase.php @@ -21,12 +21,13 @@ namespace OCA\Files_Trashbin\Tests; -use OC\Files\Cache\Watcher; use OC\Files\Filesystem; use OC\Files\View; use OCA\Files_Sharing\AppInfo\Application; use OCA\Files_Trashbin\Expiration; use OCA\Files_Trashbin\Trashbin; +use OCP\Files\Cache\IWatcher; +use OCP\IConfig; /** * Class TrashbinTestCase @@ -83,13 +84,9 @@ public static function setUpBeforeClass(): void { public static function tearDownAfterClass(): void { // cleanup test user $user = \OC::$server->getUserManager()->get(self::TEST_TRASHBIN_USER1); - if ($user !== null) { - $user->delete(); - } + $user?->delete(); $user = \OC::$server->getUserManager()->get(self::TEST_TRASHBIN_USER2); - if ($user !== null) { - $user->delete(); - } + $user?->delete(); \OC::$server->getConfig()->setSystemValue('trashbin_retention_obligation', self::$rememberRetentionObligation); @@ -109,16 +106,17 @@ protected function setUp(): void { \OC::$server->getAppManager()->enableApp('files_trashbin'); $config = \OC::$server->getConfig(); - $mockConfig = $this->createMock('\OCP\IConfig'); - $mockConfig->expects($this->any()) + $mockConfig = $this->createMock(IConfig::class); + $mockConfig ->method('getSystemValue') - ->will($this->returnCallback(function ($key, $default) use ($config) { + ->willReturnCallback(function ($key, $default) use ($config) { if ($key === 'filesystem_check_changes') { - return Watcher::CHECK_ONCE; - } else { - return $config->getSystemValue($key, $default); + return IWatcher::CHECK_ONCE; } - })); + + return $config->getSystemValue($key, $default); + }); + $mockConfig->method('getUserValue')->willReturnArgument(2); $this->overwriteService('AllConfig', $mockConfig); $this->trashRoot1 = '/' . self::TEST_TRASHBIN_USER1 . '/files_trashbin'; @@ -138,7 +136,7 @@ protected function tearDown(): void { // clear trash table $connection = \OC::$server->getDatabaseConnection(); - $connection->executeUpdate('DELETE FROM `*PREFIX*files_trash`'); + $connection->executeStatement('DELETE FROM `*PREFIX*files_trash`'); parent::tearDown(); } @@ -147,7 +145,7 @@ protected function tearDown(): void { * @param string $user * @param bool $create */ - protected static function loginHelper($user, $create = false) { + protected static function loginHelper($user, $create = false): void { if ($create) { try { \OC::$server->getUserManager()->createUser($user, $user); diff --git a/apps/files_versions/tests/VersioningTest.php b/apps/files_versions/tests/VersioningTest.php index 3e6623e93a41..037f707fe79f 100644 --- a/apps/files_versions/tests/VersioningTest.php +++ b/apps/files_versions/tests/VersioningTest.php @@ -54,7 +54,6 @@ use OCP\IConfig; use OCP\Util; use PHPUnit\Framework\MockObject\MockObject; -use ReflectionClass; use Test\TestCase; use function basename; use function file_exists; @@ -178,6 +177,7 @@ private function overwriteConfig($saveVersionMetadata=false, $versionsRetentionO return $config->getSystemValue($key, $default); }); + $this->mockConfig->method('getAppValue')->willReturnArgument(2); $this->overwriteService('AllConfig', $this->mockConfig); @@ -1407,17 +1407,11 @@ private function createAndCheckVersions(View $view, $path): void { * @param string $user * @param bool $create */ - public static function loginHelper($user, $create = false): void { + public static function loginHelper(string $user, bool $create = false): void { if ($create) { OC::$server->getUserManager()->createUser($user, $user); } - $storage = new ReflectionClass('\OCA\Files_Sharing\SharedStorage'); - $isInitialized = $storage->getProperty('initialized'); - $isInitialized->setAccessible(true); - $isInitialized->setValue($storage, false); - $isInitialized->setAccessible(false); - OC_Util::tearDownFS(); OC_User::setUserId(''); Filesystem::tearDown(); diff --git a/composer.json b/composer.json index 3371b53e4ec9..1c5591c85cb5 100644 --- a/composer.json +++ b/composer.json @@ -7,12 +7,13 @@ "optimize-autoloader": true, "classmap-authoritative": false, "platform": { - "php": "7.4" + "php": "8.2" }, "allow-plugins": { "bamarni/composer-bin-plugin": true, "dg/composer-cleaner": true - } + }, + "sort-packages": true }, "autoload" : { "psr-4": { @@ -40,11 +41,10 @@ "require-dev": { "bamarni/composer-bin-plugin": "^1.8", "mikey179/vfsstream": "^1.6", - "phpunit/phpunit": "^9.5", - "roave/security-advisories": "dev-latest" + "phpunit/phpunit": "^9.5" }, "require": { - "php": ">=7.4", + "php": ">=8.2", "ext-apcu": "*", "ext-ctype": "*", "ext-curl": "*", @@ -90,9 +90,9 @@ "sabre/dav": "^4.4", "sabre/http": "^5.1", "sabre/vobject": "^4.5", - "swiftmailer/swiftmailer": "^6.3", "symfony/console": "^5.4", "symfony/event-dispatcher": "^5.4", + "symfony/mailer": "^5.4", "symfony/process": "^5.4", "symfony/routing": "^5.4", "symfony/translation": "^5.4" diff --git a/composer.lock b/composer.lock index 1cdc0ef95382..77f333d692da 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "9a78206698bfb4ba4dcf1c35c9509e5d", + "content-hash": "d5a7c6738f14546ca1f30741b6cdaf3e", "packages": [ { "name": "bantu/ini-get-wrapper", @@ -407,29 +407,29 @@ }, { "name": "doctrine/deprecations", - "version": "1.1.5", + "version": "1.1.6", "source": { "type": "git", "url": "https://github.com/doctrine/deprecations.git", - "reference": "459c2f5dd3d6a4633d3b5f46ee2b1c40f57d3f38" + "reference": "d4fe3e6fd9bb9e72557a19674f44d8ac7db4c6ca" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/deprecations/zipball/459c2f5dd3d6a4633d3b5f46ee2b1c40f57d3f38", - "reference": "459c2f5dd3d6a4633d3b5f46ee2b1c40f57d3f38", + "url": "https://api.github.com/repos/doctrine/deprecations/zipball/d4fe3e6fd9bb9e72557a19674f44d8ac7db4c6ca", + "reference": "d4fe3e6fd9bb9e72557a19674f44d8ac7db4c6ca", "shasum": "" }, "require": { "php": "^7.1 || ^8.0" }, "conflict": { - "phpunit/phpunit": "<=7.5 || >=13" + "phpunit/phpunit": "<=7.5 || >=14" }, "require-dev": { - "doctrine/coding-standard": "^9 || ^12 || ^13", - "phpstan/phpstan": "1.4.10 || 2.1.11", + "doctrine/coding-standard": "^9 || ^12 || ^14", + "phpstan/phpstan": "1.4.10 || 2.1.30", "phpstan/phpstan-phpunit": "^1.0 || ^2", - "phpunit/phpunit": "^7.5 || ^8.5 || ^9.6 || ^10.5 || ^11.5 || ^12", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.6 || ^10.5 || ^11.5 || ^12.4 || ^13.0", "psr/log": "^1 || ^2 || ^3" }, "suggest": { @@ -449,36 +449,35 @@ "homepage": "https://www.doctrine-project.org/", "support": { "issues": "https://github.com/doctrine/deprecations/issues", - "source": "https://github.com/doctrine/deprecations/tree/1.1.5" + "source": "https://github.com/doctrine/deprecations/tree/1.1.6" }, - "time": "2025-04-07T20:06:18+00:00" + "time": "2026-02-07T07:09:04+00:00" }, { "name": "doctrine/event-manager", - "version": "1.2.0", + "version": "2.1.1", "source": { "type": "git", "url": "https://github.com/doctrine/event-manager.git", - "reference": "95aa4cb529f1e96576f3fda9f5705ada4056a520" + "reference": "dda33921b198841ca8dbad2eaa5d4d34769d18cf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/event-manager/zipball/95aa4cb529f1e96576f3fda9f5705ada4056a520", - "reference": "95aa4cb529f1e96576f3fda9f5705ada4056a520", + "url": "https://api.github.com/repos/doctrine/event-manager/zipball/dda33921b198841ca8dbad2eaa5d4d34769d18cf", + "reference": "dda33921b198841ca8dbad2eaa5d4d34769d18cf", "shasum": "" }, "require": { - "doctrine/deprecations": "^0.5.3 || ^1", - "php": "^7.1 || ^8.0" + "php": "^8.1" }, "conflict": { "doctrine/common": "<2.9" }, "require-dev": { - "doctrine/coding-standard": "^9 || ^10", - "phpstan/phpstan": "~1.4.10 || ^1.8.8", - "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", - "vimeo/psalm": "^4.24" + "doctrine/coding-standard": "^14", + "phpdocumentor/guides-cli": "^1.4", + "phpstan/phpstan": "^2.1.32", + "phpunit/phpunit": "^10.5.58" }, "type": "library", "autoload": { @@ -527,7 +526,7 @@ ], "support": { "issues": "https://github.com/doctrine/event-manager/issues", - "source": "https://github.com/doctrine/event-manager/tree/1.2.0" + "source": "https://github.com/doctrine/event-manager/tree/2.1.1" }, "funding": [ { @@ -543,32 +542,31 @@ "type": "tidelift" } ], - "time": "2022-10-12T20:51:15+00:00" + "time": "2026-01-29T07:11:08+00:00" }, { "name": "doctrine/lexer", - "version": "2.1.1", + "version": "3.0.1", "source": { "type": "git", "url": "https://github.com/doctrine/lexer.git", - "reference": "861c870e8b75f7c8f69c146c7f89cc1c0f1b49b6" + "reference": "31ad66abc0fc9e1a1f2d9bc6a42668d2fbbcd6dd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/lexer/zipball/861c870e8b75f7c8f69c146c7f89cc1c0f1b49b6", - "reference": "861c870e8b75f7c8f69c146c7f89cc1c0f1b49b6", + "url": "https://api.github.com/repos/doctrine/lexer/zipball/31ad66abc0fc9e1a1f2d9bc6a42668d2fbbcd6dd", + "reference": "31ad66abc0fc9e1a1f2d9bc6a42668d2fbbcd6dd", "shasum": "" }, "require": { - "doctrine/deprecations": "^1.0", - "php": "^7.1 || ^8.0" + "php": "^8.1" }, "require-dev": { - "doctrine/coding-standard": "^9 || ^12", - "phpstan/phpstan": "^1.3", - "phpunit/phpunit": "^7.5 || ^8.5 || ^9.6", + "doctrine/coding-standard": "^12", + "phpstan/phpstan": "^1.10", + "phpunit/phpunit": "^10.5", "psalm/plugin-phpunit": "^0.18.3", - "vimeo/psalm": "^4.11 || ^5.21" + "vimeo/psalm": "^5.21" }, "type": "library", "autoload": { @@ -605,7 +603,7 @@ ], "support": { "issues": "https://github.com/doctrine/lexer/issues", - "source": "https://github.com/doctrine/lexer/tree/2.1.1" + "source": "https://github.com/doctrine/lexer/tree/3.0.1" }, "funding": [ { @@ -621,30 +619,30 @@ "type": "tidelift" } ], - "time": "2024-02-05T11:35:39+00:00" + "time": "2024-02-05T11:56:58+00:00" }, { "name": "egulias/email-validator", - "version": "3.2.6", + "version": "4.0.4", "source": { "type": "git", "url": "https://github.com/egulias/EmailValidator.git", - "reference": "e5997fa97e8790cdae03a9cbd5e78e45e3c7bda7" + "reference": "d42c8731f0624ad6bdc8d3e5e9a4524f68801cfa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/egulias/EmailValidator/zipball/e5997fa97e8790cdae03a9cbd5e78e45e3c7bda7", - "reference": "e5997fa97e8790cdae03a9cbd5e78e45e3c7bda7", + "url": "https://api.github.com/repos/egulias/EmailValidator/zipball/d42c8731f0624ad6bdc8d3e5e9a4524f68801cfa", + "reference": "d42c8731f0624ad6bdc8d3e5e9a4524f68801cfa", "shasum": "" }, "require": { - "doctrine/lexer": "^1.2|^2", - "php": ">=7.2", - "symfony/polyfill-intl-idn": "^1.15" + "doctrine/lexer": "^2.0 || ^3.0", + "php": ">=8.1", + "symfony/polyfill-intl-idn": "^1.26" }, "require-dev": { - "phpunit/phpunit": "^8.5.8|^9.3.3", - "vimeo/psalm": "^4" + "phpunit/phpunit": "^10.2", + "vimeo/psalm": "^5.12" }, "suggest": { "ext-intl": "PHP Internationalization Libraries are required to use the SpoofChecking validation" @@ -652,7 +650,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0.x-dev" + "dev-master": "4.0.x-dev" } }, "autoload": { @@ -680,7 +678,7 @@ ], "support": { "issues": "https://github.com/egulias/EmailValidator/issues", - "source": "https://github.com/egulias/EmailValidator/tree/3.2.6" + "source": "https://github.com/egulias/EmailValidator/tree/4.0.4" }, "funding": [ { @@ -688,30 +686,30 @@ "type": "github" } ], - "time": "2023-06-01T07:04:22+00:00" + "time": "2025-03-06T22:45:56+00:00" }, { "name": "firebase/php-jwt", - "version": "v6.10.0", + "version": "v6.11.1", "source": { "type": "git", "url": "https://github.com/firebase/php-jwt.git", - "reference": "a49db6f0a5033aef5143295342f1c95521b075ff" + "reference": "d1e91ecf8c598d073d0995afa8cd5c75c6e19e66" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/firebase/php-jwt/zipball/a49db6f0a5033aef5143295342f1c95521b075ff", - "reference": "a49db6f0a5033aef5143295342f1c95521b075ff", + "url": "https://api.github.com/repos/firebase/php-jwt/zipball/d1e91ecf8c598d073d0995afa8cd5c75c6e19e66", + "reference": "d1e91ecf8c598d073d0995afa8cd5c75c6e19e66", "shasum": "" }, "require": { - "php": "^7.4||^8.0" + "php": "^8.0" }, "require-dev": { - "guzzlehttp/guzzle": "^6.5||^7.4", + "guzzlehttp/guzzle": "^7.4", "phpspec/prophecy-phpunit": "^2.0", "phpunit/phpunit": "^9.5", - "psr/cache": "^1.0||^2.0", + "psr/cache": "^2.0||^3.0", "psr/http-client": "^1.0", "psr/http-factory": "^1.0" }, @@ -749,40 +747,40 @@ ], "support": { "issues": "https://github.com/firebase/php-jwt/issues", - "source": "https://github.com/firebase/php-jwt/tree/v6.10.0" + "source": "https://github.com/firebase/php-jwt/tree/v6.11.1" }, - "time": "2023-12-01T16:26:39+00:00" + "time": "2025-04-09T20:32:01+00:00" }, { "name": "google/apiclient", - "version": "v2.16.1", + "version": "v2.19.0", "source": { "type": "git", "url": "https://github.com/googleapis/google-api-php-client.git", - "reference": "d7066f3a205aaeb83cce439613770e69394a43c8" + "reference": "b18fa8aed7b2b2dd4bcce74e2c7d267e16007ea9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/googleapis/google-api-php-client/zipball/d7066f3a205aaeb83cce439613770e69394a43c8", - "reference": "d7066f3a205aaeb83cce439613770e69394a43c8", + "url": "https://api.github.com/repos/googleapis/google-api-php-client/zipball/b18fa8aed7b2b2dd4bcce74e2c7d267e16007ea9", + "reference": "b18fa8aed7b2b2dd4bcce74e2c7d267e16007ea9", "shasum": "" }, "require": { - "firebase/php-jwt": "~6.0", + "firebase/php-jwt": "^6.0||^7.0", "google/apiclient-services": "~0.350", "google/auth": "^1.37", - "guzzlehttp/guzzle": "^6.5.8||^7.4.5", - "guzzlehttp/psr7": "^1.9.1||^2.2.1", + "guzzlehttp/guzzle": "^7.4.5", + "guzzlehttp/psr7": "^2.6", "monolog/monolog": "^2.9||^3.0", - "php": "^7.4|^8.0", + "php": "^8.1", "phpseclib/phpseclib": "^3.0.36" }, "require-dev": { "cache/filesystem-adapter": "^1.1", "composer/composer": "^1.10.23", "phpcompatibility/php-compatibility": "^9.2", - "phpspec/prophecy-phpunit": "^2.0", - "phpunit/phpunit": "^9.5", + "phpspec/prophecy-phpunit": "^2.1", + "phpunit/phpunit": "^9.6", "squizlabs/php_codesniffer": "^3.8", "symfony/css-selector": "~2.1", "symfony/dom-crawler": "~2.1" @@ -818,29 +816,29 @@ ], "support": { "issues": "https://github.com/googleapis/google-api-php-client/issues", - "source": "https://github.com/googleapis/google-api-php-client/tree/v2.16.1" + "source": "https://github.com/googleapis/google-api-php-client/tree/v2.19.0" }, - "time": "2024-12-12T17:34:46+00:00" + "time": "2026-01-09T19:59:47+00:00" }, { "name": "google/apiclient-services", - "version": "v0.355.0", + "version": "v0.434.0", "source": { "type": "git", "url": "https://github.com/googleapis/google-api-php-client-services.git", - "reference": "235e6a45ecafd77accc102b5ab6d529aab54da23" + "reference": "65550d5fd5c468badd75db9ec73c2c187470a00d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/googleapis/google-api-php-client-services/zipball/235e6a45ecafd77accc102b5ab6d529aab54da23", - "reference": "235e6a45ecafd77accc102b5ab6d529aab54da23", + "url": "https://api.github.com/repos/googleapis/google-api-php-client-services/zipball/65550d5fd5c468badd75db9ec73c2c187470a00d", + "reference": "65550d5fd5c468badd75db9ec73c2c187470a00d", "shasum": "" }, "require": { - "php": "^7.4||^8.0" + "php": "^8.1" }, "require-dev": { - "phpunit/phpunit": "^5.7||^8.5.13" + "phpunit/phpunit": "^9.6" }, "type": "library", "autoload": { @@ -862,40 +860,42 @@ ], "support": { "issues": "https://github.com/googleapis/google-api-php-client-services/issues", - "source": "https://github.com/googleapis/google-api-php-client-services/tree/v0.355.0" + "source": "https://github.com/googleapis/google-api-php-client-services/tree/v0.434.0" }, - "time": "2024-05-11T01:02:11+00:00" + "time": "2026-02-18T01:00:35+00:00" }, { "name": "google/auth", - "version": "v1.37.2", + "version": "v1.44.0", "source": { "type": "git", "url": "https://github.com/googleapis/google-auth-library-php.git", - "reference": "25eed0045d8cf107424a8b9010c9fdcc0734ceb0" + "reference": "5670e56307d7a2eac931f677c0e59a4f8abb2e43" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/googleapis/google-auth-library-php/zipball/25eed0045d8cf107424a8b9010c9fdcc0734ceb0", - "reference": "25eed0045d8cf107424a8b9010c9fdcc0734ceb0", + "url": "https://api.github.com/repos/googleapis/google-auth-library-php/zipball/5670e56307d7a2eac931f677c0e59a4f8abb2e43", + "reference": "5670e56307d7a2eac931f677c0e59a4f8abb2e43", "shasum": "" }, "require": { "firebase/php-jwt": "^6.0", - "guzzlehttp/guzzle": "^6.5.8||^7.4.5", + "guzzlehttp/guzzle": "^7.4.5", "guzzlehttp/psr7": "^2.4.5", - "php": "^7.4||^8.0", - "psr/cache": "^1.0||^2.0||^3.0", + "php": "^8.1", + "psr/cache": "^2.0||^3.0", "psr/http-message": "^1.1||^2.0" }, "require-dev": { "guzzlehttp/promises": "^2.0", "kelvinmo/simplejwt": "0.7.1", - "phpseclib/phpseclib": "^3.0", - "phpspec/prophecy-phpunit": "^2.0", - "phpunit/phpunit": "^9.0.0", + "phpseclib/phpseclib": "^3.0.35", + "phpspec/prophecy-phpunit": "^2.1", + "phpunit/phpunit": "^9.6", "sebastian/comparator": ">=1.2.3", - "squizlabs/php_codesniffer": "^3.5" + "squizlabs/php_codesniffer": "^3.5", + "symfony/process": "^6.0||^7.0", + "webmozart/assert": "^1.11" }, "suggest": { "phpseclib/phpseclib": "May be used in place of OpenSSL for signing strings or for token management. Please require version ^2." @@ -920,9 +920,9 @@ "support": { "docs": "https://googleapis.github.io/google-auth-library-php/main/", "issues": "https://github.com/googleapis/google-auth-library-php/issues", - "source": "https://github.com/googleapis/google-auth-library-php/tree/v1.37.2" + "source": "https://github.com/googleapis/google-auth-library-php/tree/v1.44.0" }, - "time": "2024-12-11T18:15:11+00:00" + "time": "2024-12-04T15:34:58+00:00" }, { "name": "guzzlehttp/guzzle", @@ -1251,21 +1251,21 @@ }, { "name": "icewind/smb", - "version": "v3.7.0", + "version": "3.8.1", "source": { "type": "git", "url": "https://codeberg.org/icewind/SMB", - "reference": "e6904cbe75f678335092f4861c60c656b1a99e84" + "reference": "97063a63b44edc6554966f6121679506b8d85103" }, "require": { "icewind/streams": ">=0.7.3", - "php": ">=7.2" + "php": ">=8.2" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^2.16", + "friendsofphp/php-cs-fixer": "v3.89.0", "phpstan/phpstan": "^0.12.57", - "phpunit/phpunit": "^8.5|^9.3.8", - "psalm/phar": "^4.3" + "phpunit/phpunit": "10.5.58", + "psalm/phar": "6.*" }, "type": "library", "autoload": { @@ -1280,11 +1280,11 @@ "authors": [ { "name": "Robin Appelman", - "email": "icewind@owncloud.com" + "email": "robin@icewind.nl" } ], "description": "php wrapper for smbclient and libsmbclient-php", - "time": "2024-11-11T14:08:34+00:00" + "time": "2025-11-13T16:17:19+00:00" }, { "name": "icewind/streams", @@ -1380,38 +1380,38 @@ }, { "name": "laminas/laminas-filter", - "version": "2.22.0", + "version": "2.42.0", "source": { "type": "git", "url": "https://github.com/laminas/laminas-filter.git", - "reference": "c48e8a392a81de7d211026c078dce0e8bc57e2e3" + "reference": "985d27bd42daf51b415ce1ee889e0978cc1e59ed" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laminas/laminas-filter/zipball/c48e8a392a81de7d211026c078dce0e8bc57e2e3", - "reference": "c48e8a392a81de7d211026c078dce0e8bc57e2e3", + "url": "https://api.github.com/repos/laminas/laminas-filter/zipball/985d27bd42daf51b415ce1ee889e0978cc1e59ed", + "reference": "985d27bd42daf51b415ce1ee889e0978cc1e59ed", "shasum": "" }, "require": { "ext-mbstring": "*", - "laminas/laminas-servicemanager": "^3.14.0", - "laminas/laminas-stdlib": "^3.13.0", - "php": "^7.4 || ~8.0.0 || ~8.1.0" + "laminas/laminas-servicemanager": "^3.21.0", + "laminas/laminas-stdlib": "^3.19.0", + "php": "~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0" }, "conflict": { "laminas/laminas-validator": "<2.10.1", "zendframework/zend-filter": "*" }, "require-dev": { - "laminas/laminas-coding-standard": "~2.4.0", - "laminas/laminas-crypt": "^3.5.1", - "laminas/laminas-uri": "^2.9.1", - "pear/archive_tar": "^1.4.14", - "phpspec/prophecy-phpunit": "^2.0.1", - "phpunit/phpunit": "^9.5.24", - "psalm/plugin-phpunit": "^0.17.0", - "psr/http-factory": "^1.0.1", - "vimeo/psalm": "^4.27.0" + "laminas/laminas-coding-standard": "^3.1", + "laminas/laminas-crypt": "^3.12", + "laminas/laminas-i18n": "^2.30.0", + "laminas/laminas-uri": "^2.13", + "pear/archive_tar": "^1.6.0", + "phpunit/phpunit": "^10.5.58", + "psalm/plugin-phpunit": "^0.19.0", + "psr/http-factory": "^1.1.0", + "vimeo/psalm": "^5.26.1" }, "suggest": { "laminas/laminas-crypt": "Laminas\\Crypt component, for encryption filters", @@ -1455,41 +1455,40 @@ "type": "community_bridge" } ], - "time": "2022-10-11T08:14:46+00:00" + "time": "2025-10-13T15:44:52+00:00" }, { "name": "laminas/laminas-inputfilter", - "version": "2.21.0", + "version": "2.35.0", "source": { "type": "git", "url": "https://github.com/laminas/laminas-inputfilter.git", - "reference": "8668227246d19564f339643f0f2aedcdff66612b" + "reference": "326d2dac38814f70902a3a9e0062f740d06f89c5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laminas/laminas-inputfilter/zipball/8668227246d19564f339643f0f2aedcdff66612b", - "reference": "8668227246d19564f339643f0f2aedcdff66612b", + "url": "https://api.github.com/repos/laminas/laminas-inputfilter/zipball/326d2dac38814f70902a3a9e0062f740d06f89c5", + "reference": "326d2dac38814f70902a3a9e0062f740d06f89c5", "shasum": "" }, "require": { - "laminas/laminas-filter": "^2.13", - "laminas/laminas-servicemanager": "^3.16.0", - "laminas/laminas-stdlib": "^3.0", - "laminas/laminas-validator": "^2.15", - "php": "^7.4 || ~8.0.0 || ~8.1.0" + "laminas/laminas-filter": "^2.19", + "laminas/laminas-servicemanager": "^3.21.0", + "laminas/laminas-stdlib": "^3.19", + "laminas/laminas-validator": "^2.60.0", + "php": "~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0", + "psr/container": "^1.1 || ^2.0" }, "conflict": { "zendframework/zend-inputfilter": "*" }, "require-dev": { "ext-json": "*", - "laminas/laminas-coding-standard": "~2.4.0", - "laminas/laminas-db": "^2.15.0", - "phpunit/phpunit": "^9.5.24", - "psalm/plugin-phpunit": "^0.17.0", - "psr/http-message": "^1.0", - "vimeo/psalm": "^4.27.0", - "webmozart/assert": "^1.11" + "laminas/laminas-coding-standard": "^3.1.0", + "phpunit/phpunit": "^11.5.46", + "psalm/plugin-phpunit": "^0.19.5", + "psr/http-message": "^2.0", + "vimeo/psalm": "^6.14.3" }, "suggest": { "psr/http-message-implementation": "PSR-7 is required if you wish to validate PSR-7 UploadedFileInterface payloads" @@ -1530,30 +1529,30 @@ "type": "community_bridge" } ], - "time": "2022-09-20T10:03:09+00:00" + "time": "2026-01-10T15:07:43+00:00" }, { "name": "laminas/laminas-servicemanager", - "version": "3.17.0", + "version": "3.24.0", "source": { "type": "git", "url": "https://github.com/laminas/laminas-servicemanager.git", - "reference": "360be5f16955dd1edbcce1cfaa98ed82a17f02ec" + "reference": "b172a0df568bf37ebdfb3658263156eefe3c1e8c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laminas/laminas-servicemanager/zipball/360be5f16955dd1edbcce1cfaa98ed82a17f02ec", - "reference": "360be5f16955dd1edbcce1cfaa98ed82a17f02ec", + "url": "https://api.github.com/repos/laminas/laminas-servicemanager/zipball/b172a0df568bf37ebdfb3658263156eefe3c1e8c", + "reference": "b172a0df568bf37ebdfb3658263156eefe3c1e8c", "shasum": "" }, "require": { - "laminas/laminas-stdlib": "^3.2.1", - "php": "~7.4.0 || ~8.0.0 || ~8.1.0", + "laminas/laminas-stdlib": "^3.19", + "php": "~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0", "psr/container": "^1.0" }, "conflict": { "ext-psr": "*", - "laminas/laminas-code": "<3.3.1", + "laminas/laminas-code": "<4.10.0", "zendframework/zend-code": "<3.3.1", "zendframework/zend-servicemanager": "*" }, @@ -1564,20 +1563,19 @@ "container-interop/container-interop": "^1.2.0" }, "require-dev": { - "composer/package-versions-deprecated": "^1.0", - "laminas/laminas-coding-standard": "~2.4.0", - "laminas/laminas-container-config-test": "^0.7", - "laminas/laminas-dependency-plugin": "^2.1.2", - "mikey179/vfsstream": "^1.6.10@alpha", - "ocramius/proxy-manager": "^2.11", - "phpbench/phpbench": "^1.1", - "phpspec/prophecy-phpunit": "^2.0", - "phpunit/phpunit": "^9.5.5", - "psalm/plugin-phpunit": "^0.17.0", - "vimeo/psalm": "^4.8" + "composer/package-versions-deprecated": "^1.11.99.5", + "friendsofphp/proxy-manager-lts": "^1.0.18", + "laminas/laminas-code": "^4.16.0", + "laminas/laminas-coding-standard": "~2.5.0", + "laminas/laminas-container-config-test": "^0.8", + "mikey179/vfsstream": "^1.6.12", + "phpbench/phpbench": "^1.4.1", + "phpunit/phpunit": "^10.5.58", + "psalm/plugin-phpunit": "^0.18.4", + "vimeo/psalm": "^5.26.1" }, "suggest": { - "ocramius/proxy-manager": "ProxyManager ^2.1.1 to handle lazy initialization of services" + "friendsofphp/proxy-manager-lts": "ProxyManager ^2.1.1 to handle lazy initialization of services" }, "bin": [ "bin/generate-deps-for-config-factory", @@ -1621,35 +1619,34 @@ "type": "community_bridge" } ], - "time": "2022-09-22T11:33:46+00:00" + "time": "2025-10-14T09:03:51+00:00" }, { "name": "laminas/laminas-stdlib", - "version": "3.13.0", + "version": "3.21.0", "source": { "type": "git", "url": "https://github.com/laminas/laminas-stdlib.git", - "reference": "66a6d03c381f6c9f1dd988bf8244f9afb9380d76" + "reference": "b1c81514cfe158aadf724c42b34d3d0a8164c096" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laminas/laminas-stdlib/zipball/66a6d03c381f6c9f1dd988bf8244f9afb9380d76", - "reference": "66a6d03c381f6c9f1dd988bf8244f9afb9380d76", + "url": "https://api.github.com/repos/laminas/laminas-stdlib/zipball/b1c81514cfe158aadf724c42b34d3d0a8164c096", + "reference": "b1c81514cfe158aadf724c42b34d3d0a8164c096", "shasum": "" }, "require": { - "php": "^7.4 || ~8.0.0 || ~8.1.0" + "php": "~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0" }, "conflict": { "zendframework/zend-stdlib": "*" }, "require-dev": { - "laminas/laminas-coding-standard": "~2.3.0", - "phpbench/phpbench": "^1.2.6", - "phpstan/phpdoc-parser": "^0.5.4", - "phpunit/phpunit": "^9.5.23", - "psalm/plugin-phpunit": "^0.17.0", - "vimeo/psalm": "^4.26" + "laminas/laminas-coding-standard": "^3.1.0", + "phpbench/phpbench": "^1.4.1", + "phpunit/phpunit": "^11.5.42", + "psalm/plugin-phpunit": "^0.19.5", + "vimeo/psalm": "^6.13.1" }, "type": "library", "autoload": { @@ -1681,45 +1678,43 @@ "type": "community_bridge" } ], - "time": "2022-08-24T13:56:50+00:00" + "time": "2025-10-11T18:13:12+00:00" }, { "name": "laminas/laminas-validator", - "version": "2.25.0", + "version": "2.65.0", "source": { "type": "git", "url": "https://github.com/laminas/laminas-validator.git", - "reference": "42de39b78e73b321db7d948cf8530a2764f8b9aa" + "reference": "f0767ca83e0dd91a6f8ccdd4f0887eb132c0ea49" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laminas/laminas-validator/zipball/42de39b78e73b321db7d948cf8530a2764f8b9aa", - "reference": "42de39b78e73b321db7d948cf8530a2764f8b9aa", + "url": "https://api.github.com/repos/laminas/laminas-validator/zipball/f0767ca83e0dd91a6f8ccdd4f0887eb132c0ea49", + "reference": "f0767ca83e0dd91a6f8ccdd4f0887eb132c0ea49", "shasum": "" }, "require": { - "laminas/laminas-servicemanager": "^3.12.0", - "laminas/laminas-stdlib": "^3.13", - "php": "^7.4 || ~8.0.0 || ~8.1.0" + "laminas/laminas-servicemanager": "^3.21.0", + "laminas/laminas-stdlib": "^3.19", + "php": "~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0", + "psr/http-message": "^1.0.1 || ^2.0.0" }, "conflict": { "zendframework/zend-validator": "*" }, "require-dev": { - "laminas/laminas-coding-standard": "^2.4.0", - "laminas/laminas-db": "^2.15.0", - "laminas/laminas-filter": "^2.18.0", - "laminas/laminas-http": "^2.16.0", - "laminas/laminas-i18n": "^2.17.0", - "laminas/laminas-session": "^2.13.0", - "laminas/laminas-uri": "^2.9.1", - "phpspec/prophecy-phpunit": "^2.0", - "phpunit/phpunit": "^9.5.24", - "psalm/plugin-phpunit": "^0.17.0", - "psr/http-client": "^1.0", - "psr/http-factory": "^1.0", - "psr/http-message": "^1.0", - "vimeo/psalm": "^4.27.0" + "laminas/laminas-coding-standard": "^2.5", + "laminas/laminas-db": "^2.20", + "laminas/laminas-filter": "^2.41.0", + "laminas/laminas-i18n": "^2.30.0", + "laminas/laminas-session": "^2.25.1", + "laminas/laminas-uri": "^2.13.0", + "phpunit/phpunit": "^10.5.58", + "psalm/plugin-phpunit": "^0.19.0", + "psr/http-client": "^1.0.3", + "psr/http-factory": "^1.1.0", + "vimeo/psalm": "^5.26.1" }, "suggest": { "laminas/laminas-db": "Laminas\\Db component, required by the (No)RecordExists validator", @@ -1767,7 +1762,7 @@ "type": "community_bridge" } ], - "time": "2022-09-20T11:33:19+00:00" + "time": "2025-10-13T14:40:30+00:00" }, { "name": "laravel/serializable-closure", @@ -1982,42 +1977,43 @@ }, { "name": "monolog/monolog", - "version": "2.11.0", + "version": "3.10.0", "source": { "type": "git", "url": "https://github.com/Seldaek/monolog.git", - "reference": "37308608e599f34a1a4845b16440047ec98a172a" + "reference": "b321dd6749f0bf7189444158a3ce785cc16d69b0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/37308608e599f34a1a4845b16440047ec98a172a", - "reference": "37308608e599f34a1a4845b16440047ec98a172a", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/b321dd6749f0bf7189444158a3ce785cc16d69b0", + "reference": "b321dd6749f0bf7189444158a3ce785cc16d69b0", "shasum": "" }, "require": { - "php": ">=7.2", - "psr/log": "^1.0.1 || ^2.0 || ^3.0" + "php": ">=8.1", + "psr/log": "^2.0 || ^3.0" }, "provide": { - "psr/log-implementation": "1.0.0 || 2.0.0 || 3.0.0" + "psr/log-implementation": "3.0.0" }, "require-dev": { - "aws/aws-sdk-php": "^2.4.9 || ^3.0", + "aws/aws-sdk-php": "^3.0", "doctrine/couchdb": "~1.0@dev", "elasticsearch/elasticsearch": "^7 || ^8", "ext-json": "*", - "graylog2/gelf-php": "^1.4.2 || ^2@dev", - "guzzlehttp/guzzle": "^7.4", + "graylog2/gelf-php": "^1.4.2 || ^2.0", + "guzzlehttp/guzzle": "^7.4.5", "guzzlehttp/psr7": "^2.2", "mongodb/mongodb": "^1.8 || ^2.0", "php-amqplib/php-amqplib": "~2.4 || ^3", - "phpspec/prophecy": "^1.15", - "phpstan/phpstan": "^1.10", - "phpunit/phpunit": "^8.5.38 || ^9.6.19", - "predis/predis": "^1.1 || ^2.0", - "rollbar/rollbar": "^1.3 || ^2 || ^3", - "ruflin/elastica": "^7", - "swiftmailer/swiftmailer": "^5.3|^6.0", + "php-console/php-console": "^3.1.8", + "phpstan/phpstan": "^2", + "phpstan/phpstan-deprecation-rules": "^2", + "phpstan/phpstan-strict-rules": "^2", + "phpunit/phpunit": "^10.5.17 || ^11.0.7", + "predis/predis": "^1.1 || ^2", + "rollbar/rollbar": "^4.0", + "ruflin/elastica": "^7 || ^8", "symfony/mailer": "^5.4 || ^6", "symfony/mime": "^5.4 || ^6" }, @@ -2040,7 +2036,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "2.x-dev" + "dev-main": "3.x-dev" } }, "autoload": { @@ -2068,7 +2064,7 @@ ], "support": { "issues": "https://github.com/Seldaek/monolog/issues", - "source": "https://github.com/Seldaek/monolog/tree/2.11.0" + "source": "https://github.com/Seldaek/monolog/tree/3.10.0" }, "funding": [ { @@ -2080,7 +2076,7 @@ "type": "tidelift" } ], - "time": "2026-01-01T13:05:00+00:00" + "time": "2026-01-02T08:56:05+00:00" }, { "name": "nikic/php-parser", @@ -2194,24 +2190,26 @@ }, { "name": "paragonie/constant_time_encoding", - "version": "v2.8.2", + "version": "v3.1.3", "source": { "type": "git", "url": "https://github.com/paragonie/constant_time_encoding.git", - "reference": "e30811f7bc69e4b5b6d5783e712c06c8eabf0226" + "reference": "d5b01a39b3415c2cd581d3bd3a3575c1ebbd8e77" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/paragonie/constant_time_encoding/zipball/e30811f7bc69e4b5b6d5783e712c06c8eabf0226", - "reference": "e30811f7bc69e4b5b6d5783e712c06c8eabf0226", + "url": "https://api.github.com/repos/paragonie/constant_time_encoding/zipball/d5b01a39b3415c2cd581d3bd3a3575c1ebbd8e77", + "reference": "d5b01a39b3415c2cd581d3bd3a3575c1ebbd8e77", "shasum": "" }, "require": { - "php": "^7|^8" + "php": "^8" }, "require-dev": { - "phpunit/phpunit": "^6|^7|^8|^9", - "vimeo/psalm": "^1|^2|^3|^4" + "infection/infection": "^0", + "nikic/php-fuzzer": "^0", + "phpunit/phpunit": "^9|^10|^11", + "vimeo/psalm": "^4|^5|^6" }, "type": "library", "autoload": { @@ -2257,7 +2255,7 @@ "issues": "https://github.com/paragonie/constant_time_encoding/issues", "source": "https://github.com/paragonie/constant_time_encoding" }, - "time": "2025-09-24T15:12:37+00:00" + "time": "2025-09-24T15:06:41+00:00" }, { "name": "paragonie/random_compat", @@ -2428,7 +2426,6 @@ "issues": "http://pear.php.net/bugs/search.php?cmd=display&package_name[]=Console_Getopt", "source": "https://github.com/pear/Console_Getopt" }, - "abandoned": true, "time": "2019-11-20T18:27:48+00:00" }, { @@ -2651,16 +2648,16 @@ }, { "name": "pimple/pimple", - "version": "v3.6.1", + "version": "v3.6.2", "source": { "type": "git", "url": "https://github.com/silexphp/Pimple.git", - "reference": "020029849cc55ad360066844df8ed880fb20c5bb" + "reference": "8cfe7f74ac22a433d303914eba9ea4c2a834edce" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/silexphp/Pimple/zipball/020029849cc55ad360066844df8ed880fb20c5bb", - "reference": "020029849cc55ad360066844df8ed880fb20c5bb", + "url": "https://api.github.com/repos/silexphp/Pimple/zipball/8cfe7f74ac22a433d303914eba9ea4c2a834edce", + "reference": "8cfe7f74ac22a433d303914eba9ea4c2a834edce", "shasum": "" }, "require": { @@ -2673,7 +2670,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.4.x-dev" + "dev-master": "3.x-dev" } }, "autoload": { @@ -2698,26 +2695,26 @@ "dependency injection" ], "support": { - "source": "https://github.com/silexphp/Pimple/tree/v3.6.1" + "source": "https://github.com/silexphp/Pimple/tree/v3.6.2" }, - "time": "2025-12-31T08:24:29+00:00" + "time": "2026-02-26T08:23:44+00:00" }, { "name": "psr/cache", - "version": "1.0.1", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/php-fig/cache.git", - "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8" + "reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/cache/zipball/d11b50ad223250cf17b86e38383413f5a6764bf8", - "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8", + "url": "https://api.github.com/repos/php-fig/cache/zipball/aa5030cfa5405eccfdcb1083ce040c2cb8d253bf", + "reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": ">=8.0.0" }, "type": "library", "extra": { @@ -2737,7 +2734,7 @@ "authors": [ { "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "homepage": "https://www.php-fig.org/" } ], "description": "Common interface for caching libraries", @@ -2747,9 +2744,9 @@ "psr-6" ], "support": { - "source": "https://github.com/php-fig/cache/tree/master" + "source": "https://github.com/php-fig/cache/tree/3.0.0" }, - "time": "2016-08-06T20:24:11+00:00" + "time": "2021-02-03T23:26:27+00:00" }, { "name": "psr/container", @@ -3011,30 +3008,30 @@ }, { "name": "psr/log", - "version": "1.1.4", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/php-fig/log.git", - "reference": "d49695b909c3b7628b6289db5479a1c204601f11" + "reference": "ef29f6d262798707a9edd554e2b82517ef3a9376" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11", - "reference": "d49695b909c3b7628b6289db5479a1c204601f11", + "url": "https://api.github.com/repos/php-fig/log/zipball/ef29f6d262798707a9edd554e2b82517ef3a9376", + "reference": "ef29f6d262798707a9edd554e2b82517ef3a9376", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": ">=8.0.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1.x-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { "psr-4": { - "Psr\\Log\\": "Psr/Log/" + "Psr\\Log\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -3055,9 +3052,9 @@ "psr-3" ], "support": { - "source": "https://github.com/php-fig/log/tree/1.1.4" + "source": "https://github.com/php-fig/log/tree/2.0.0" }, - "time": "2021-05-03T11:20:27+00:00" + "time": "2021-07-14T16:41:46+00:00" }, { "name": "punic/punic", @@ -3681,82 +3678,6 @@ }, "time": "2024-09-06T07:37:46+00:00" }, - { - "name": "swiftmailer/swiftmailer", - "version": "v6.3.0", - "source": { - "type": "git", - "url": "https://github.com/swiftmailer/swiftmailer.git", - "reference": "8a5d5072dca8f48460fce2f4131fcc495eec654c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/8a5d5072dca8f48460fce2f4131fcc495eec654c", - "reference": "8a5d5072dca8f48460fce2f4131fcc495eec654c", - "shasum": "" - }, - "require": { - "egulias/email-validator": "^2.0|^3.1", - "php": ">=7.0.0", - "symfony/polyfill-iconv": "^1.0", - "symfony/polyfill-intl-idn": "^1.10", - "symfony/polyfill-mbstring": "^1.0" - }, - "require-dev": { - "mockery/mockery": "^1.0", - "symfony/phpunit-bridge": "^4.4|^5.4" - }, - "suggest": { - "ext-intl": "Needed to support internationalized email addresses" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "6.2-dev" - } - }, - "autoload": { - "files": [ - "lib/swift_required.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Chris Corbyn" - }, - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - } - ], - "description": "Swiftmailer, free feature-rich PHP mailer", - "homepage": "https://swiftmailer.symfony.com", - "keywords": [ - "email", - "mail", - "mailer" - ], - "support": { - "issues": "https://github.com/swiftmailer/swiftmailer/issues", - "source": "https://github.com/swiftmailer/swiftmailer/tree/v6.3.0" - }, - "funding": [ - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/swiftmailer/swiftmailer", - "type": "tidelift" - } - ], - "abandoned": "symfony/mailer", - "time": "2021-10-18T15:26:12+00:00" - }, { "name": "symfony/console", "version": "v5.4.47", @@ -3858,20 +3779,20 @@ }, { "name": "symfony/deprecation-contracts", - "version": "v2.5.4", + "version": "v3.6.0", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "605389f2a7e5625f273b53960dc46aeaf9c62918" + "reference": "63afe740e99a13ba87ec199bb07bbdee937a5b62" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/605389f2a7e5625f273b53960dc46aeaf9c62918", - "reference": "605389f2a7e5625f273b53960dc46aeaf9c62918", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/63afe740e99a13ba87ec199bb07bbdee937a5b62", + "reference": "63afe740e99a13ba87ec199bb07bbdee937a5b62", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=8.1" }, "type": "library", "extra": { @@ -3880,7 +3801,7 @@ "name": "symfony/contracts" }, "branch-alias": { - "dev-main": "2.5-dev" + "dev-main": "3.6-dev" } }, "autoload": { @@ -3905,7 +3826,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.4" + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.6.0" }, "funding": [ { @@ -3921,7 +3842,7 @@ "type": "tidelift" } ], - "time": "2024-09-25T14:11:13+00:00" + "time": "2024-09-25T14:21:43+00:00" }, { "name": "symfony/event-dispatcher", @@ -4010,25 +3931,22 @@ }, { "name": "symfony/event-dispatcher-contracts", - "version": "v2.5.4", + "version": "v3.6.0", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher-contracts.git", - "reference": "e0fe3d79b516eb75126ac6fa4cbf19b79b08c99f" + "reference": "59eb412e93815df44f05f342958efa9f46b1e586" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/e0fe3d79b516eb75126ac6fa4cbf19b79b08c99f", - "reference": "e0fe3d79b516eb75126ac6fa4cbf19b79b08c99f", + "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/59eb412e93815df44f05f342958efa9f46b1e586", + "reference": "59eb412e93815df44f05f342958efa9f46b1e586", "shasum": "" }, "require": { - "php": ">=7.2.5", + "php": ">=8.1", "psr/event-dispatcher": "^1" }, - "suggest": { - "symfony/event-dispatcher-implementation": "" - }, "type": "library", "extra": { "thanks": { @@ -4036,7 +3954,7 @@ "name": "symfony/contracts" }, "branch-alias": { - "dev-main": "2.5-dev" + "dev-main": "3.6-dev" } }, "autoload": { @@ -4069,7 +3987,83 @@ "standards" ], "support": { - "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v2.5.4" + "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v3.6.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-25T14:21:43+00:00" + }, + { + "name": "symfony/mailer", + "version": "v5.4.45", + "source": { + "type": "git", + "url": "https://github.com/symfony/mailer.git", + "reference": "f732e1fafdf0f4a2d865e91f1018aaca174aeed9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/mailer/zipball/f732e1fafdf0f4a2d865e91f1018aaca174aeed9", + "reference": "f732e1fafdf0f4a2d865e91f1018aaca174aeed9", + "shasum": "" + }, + "require": { + "egulias/email-validator": "^2.1.10|^3|^4", + "php": ">=7.2.5", + "psr/event-dispatcher": "^1", + "psr/log": "^1|^2|^3", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/event-dispatcher": "^4.4|^5.0|^6.0", + "symfony/mime": "^5.2.6|^6.0", + "symfony/polyfill-php80": "^1.16", + "symfony/service-contracts": "^1.1|^2|^3" + }, + "conflict": { + "symfony/http-kernel": "<4.4" + }, + "require-dev": { + "symfony/http-client": "^4.4|^5.0|^6.0", + "symfony/messenger": "^4.4|^5.0|^6.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Mailer\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Helps sending emails", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/mailer/tree/v5.4.45" }, "funding": [ { @@ -4087,6 +4081,95 @@ ], "time": "2024-09-25T14:11:13+00:00" }, + { + "name": "symfony/mime", + "version": "v6.4.34", + "source": { + "type": "git", + "url": "https://github.com/symfony/mime.git", + "reference": "2b32fbbe10b36a8379efab6e702ad8b917151839" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/mime/zipball/2b32fbbe10b36a8379efab6e702ad8b917151839", + "reference": "2b32fbbe10b36a8379efab6e702ad8b917151839", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "symfony/deprecation-contracts": "^2.5|^3", + "symfony/polyfill-intl-idn": "^1.10", + "symfony/polyfill-mbstring": "^1.0" + }, + "conflict": { + "egulias/email-validator": "~3.0.0", + "phpdocumentor/reflection-docblock": "<3.2.2", + "phpdocumentor/type-resolver": "<1.4.0", + "symfony/mailer": "<5.4", + "symfony/serializer": "<6.4.3|>7.0,<7.0.3" + }, + "require-dev": { + "egulias/email-validator": "^2.1.10|^3.1|^4", + "league/html-to-markdown": "^5.0", + "phpdocumentor/reflection-docblock": "^3.0|^4.0|^5.0", + "symfony/dependency-injection": "^5.4|^6.0|^7.0", + "symfony/process": "^5.4|^6.4|^7.0", + "symfony/property-access": "^5.4|^6.0|^7.0", + "symfony/property-info": "^5.4|^6.0|^7.0", + "symfony/serializer": "^6.4.3|^7.0.3" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Mime\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Allows manipulating MIME messages", + "homepage": "https://symfony.com", + "keywords": [ + "mime", + "mime-type" + ], + "support": { + "source": "https://github.com/symfony/mime/tree/v6.4.34" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2026-02-02T17:01:23+00:00" + }, { "name": "symfony/polyfill-php80", "version": "v1.33.0", @@ -4329,29 +4412,26 @@ }, { "name": "symfony/service-contracts", - "version": "v2.5.4", + "version": "v3.6.1", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "f37b419f7aea2e9abf10abd261832cace12e3300" + "reference": "45112560a3ba2d715666a509a0bc9521d10b6c43" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/f37b419f7aea2e9abf10abd261832cace12e3300", - "reference": "f37b419f7aea2e9abf10abd261832cace12e3300", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/45112560a3ba2d715666a509a0bc9521d10b6c43", + "reference": "45112560a3ba2d715666a509a0bc9521d10b6c43", "shasum": "" }, "require": { - "php": ">=7.2.5", - "psr/container": "^1.1", - "symfony/deprecation-contracts": "^2.1|^3" + "php": ">=8.1", + "psr/container": "^1.1|^2.0", + "symfony/deprecation-contracts": "^2.5|^3" }, "conflict": { "ext-psr": "<1.1|>=2" }, - "suggest": { - "symfony/service-implementation": "" - }, "type": "library", "extra": { "thanks": { @@ -4359,13 +4439,16 @@ "name": "symfony/contracts" }, "branch-alias": { - "dev-main": "2.5-dev" + "dev-main": "3.6-dev" } }, "autoload": { "psr-4": { "Symfony\\Contracts\\Service\\": "" - } + }, + "exclude-from-classmap": [ + "/Test/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -4392,7 +4475,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/service-contracts/tree/v2.5.4" + "source": "https://github.com/symfony/service-contracts/tree/v3.6.1" }, "funding": [ { @@ -4403,43 +4486,46 @@ "url": "https://github.com/fabpot", "type": "github" }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, { "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", "type": "tidelift" } ], - "time": "2024-09-25T14:11:13+00:00" + "time": "2025-07-15T11:30:57+00:00" }, { "name": "symfony/string", - "version": "v5.4.47", + "version": "v6.4.34", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "136ca7d72f72b599f2631aca474a4f8e26719799" + "reference": "2adaf4106f2ef4c67271971bde6d3fe0a6936432" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/136ca7d72f72b599f2631aca474a4f8e26719799", - "reference": "136ca7d72f72b599f2631aca474a4f8e26719799", + "url": "https://api.github.com/repos/symfony/string/zipball/2adaf4106f2ef4c67271971bde6d3fe0a6936432", + "reference": "2adaf4106f2ef4c67271971bde6d3fe0a6936432", "shasum": "" }, "require": { - "php": ">=7.2.5", + "php": ">=8.1", "symfony/polyfill-ctype": "~1.8", "symfony/polyfill-intl-grapheme": "~1.0", "symfony/polyfill-intl-normalizer": "~1.0", - "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php80": "~1.15" + "symfony/polyfill-mbstring": "~1.0" }, "conflict": { - "symfony/translation-contracts": ">=3.0" + "symfony/translation-contracts": "<2.5" }, "require-dev": { - "symfony/error-handler": "^4.4|^5.0|^6.0", - "symfony/http-client": "^4.4|^5.0|^6.0", - "symfony/translation-contracts": "^1.1|^2", - "symfony/var-exporter": "^4.4|^5.0|^6.0" + "symfony/http-client": "^5.4|^6.0|^7.0", + "symfony/intl": "^6.2|^7.0", + "symfony/translation-contracts": "^2.5|^3.0", + "symfony/var-exporter": "^5.4|^6.0|^7.0" }, "type": "library", "autoload": { @@ -4478,7 +4564,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v5.4.47" + "source": "https://github.com/symfony/string/tree/v6.4.34" }, "funding": [ { @@ -4489,12 +4575,16 @@ "url": "https://github.com/fabpot", "type": "github" }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, { "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", "type": "tidelift" } ], - "time": "2024-11-10T20:33:58+00:00" + "time": "2026-02-08T20:44:54+00:00" }, { "name": "symfony/translation", @@ -4732,30 +4822,30 @@ }, { "name": "doctrine/instantiator", - "version": "1.5.0", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "0a0fa9780f5d4e507415a065172d26a98d02047b" + "reference": "c6222283fa3f4ac679f8b9ced9a4e23f163e80d0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/0a0fa9780f5d4e507415a065172d26a98d02047b", - "reference": "0a0fa9780f5d4e507415a065172d26a98d02047b", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/c6222283fa3f4ac679f8b9ced9a4e23f163e80d0", + "reference": "c6222283fa3f4ac679f8b9ced9a4e23f163e80d0", "shasum": "" }, "require": { - "php": "^7.1 || ^8.0" + "php": "^8.1" }, "require-dev": { - "doctrine/coding-standard": "^9 || ^11", + "doctrine/coding-standard": "^11", "ext-pdo": "*", "ext-phar": "*", - "phpbench/phpbench": "^0.16 || ^1", - "phpstan/phpstan": "^1.4", - "phpstan/phpstan-phpunit": "^1", - "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", - "vimeo/psalm": "^4.30 || ^5.4" + "phpbench/phpbench": "^1.2", + "phpstan/phpstan": "^1.9.4", + "phpstan/phpstan-phpunit": "^1.3", + "phpunit/phpunit": "^9.5.27", + "vimeo/psalm": "^5.4" }, "type": "library", "autoload": { @@ -4782,7 +4872,7 @@ ], "support": { "issues": "https://github.com/doctrine/instantiator/issues", - "source": "https://github.com/doctrine/instantiator/tree/1.5.0" + "source": "https://github.com/doctrine/instantiator/tree/2.0.0" }, "funding": [ { @@ -4798,7 +4888,7 @@ "type": "tidelift" } ], - "time": "2022-12-30T00:15:36+00:00" + "time": "2022-12-30T00:23:10+00:00" }, { "name": "mikey179/vfsstream", @@ -5460,1022 +5550,6 @@ ], "time": "2026-01-27T05:45:00+00:00" }, - { - "name": "roave/security-advisories", - "version": "dev-latest", - "source": { - "type": "git", - "url": "https://github.com/Roave/SecurityAdvisories.git", - "reference": "8457f2008fc6396be788162c4e04228028306534" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/8457f2008fc6396be788162c4e04228028306534", - "reference": "8457f2008fc6396be788162c4e04228028306534", - "shasum": "" - }, - "conflict": { - "3f/pygmentize": "<1.2", - "adaptcms/adaptcms": "<=1.3", - "admidio/admidio": "<=4.3.16", - "adodb/adodb-php": "<=5.22.9", - "aheinze/cockpit": "<2.2", - "aimeos/ai-admin-graphql": ">=2022.04.1,<2022.10.10|>=2023.04.1,<2023.10.6|>=2024.04.1,<2024.07.2", - "aimeos/ai-admin-jsonadm": "<2020.10.13|>=2021.04.1,<2021.10.6|>=2022.04.1,<2022.10.3|>=2023.04.1,<2023.10.4|==2024.04.1", - "aimeos/ai-client-html": ">=2020.04.1,<2020.10.27|>=2021.04.1,<2021.10.22|>=2022.04.1,<2022.10.13|>=2023.04.1,<2023.10.15|>=2024.04.1,<2024.04.7", - "aimeos/ai-cms-grapesjs": ">=2021.04.1,<2021.10.8|>=2022.04.1,<2022.10.9|>=2023.04.1,<2023.10.15|>=2024.04.1,<2024.10.8|>=2025.04.1,<2025.10.2", - "aimeos/ai-controller-frontend": "<2020.10.15|>=2021.04.1,<2021.10.8|>=2022.04.1,<2022.10.8|>=2023.04.1,<2023.10.9|==2024.04.1", - "aimeos/aimeos-core": ">=2022.04.1,<2022.10.17|>=2023.04.1,<2023.10.17|>=2024.04.1,<2024.04.7", - "aimeos/aimeos-laravel": "==2021.10", - "aimeos/aimeos-typo3": "<19.10.12|>=20,<20.10.5", - "airesvsg/acf-to-rest-api": "<=3.1", - "akaunting/akaunting": "<2.1.13", - "akeneo/pim-community-dev": "<5.0.119|>=6,<6.0.53", - "alextselegidis/easyappointments": "<=1.5.2", - "alexusmai/laravel-file-manager": "<=3.3.1", - "algolia/algoliasearch-magento-2": "<=3.16.1|>=3.17.0.0-beta1,<=3.17.1", - "alt-design/alt-redirect": "<1.6.4", - "altcha-org/altcha": "<1.3.1", - "alterphp/easyadmin-extension-bundle": ">=1.2,<1.2.11|>=1.3,<1.3.1", - "amazing/media2click": ">=1,<1.3.3", - "ameos/ameos_tarteaucitron": "<1.2.23", - "amphp/artax": "<1.0.6|>=2,<2.0.6", - "amphp/http": "<=1.7.2|>=2,<=2.1", - "amphp/http-client": ">=4,<4.4", - "anchorcms/anchor-cms": "<=0.12.7", - "andreapollastri/cipi": "<=3.1.15", - "andrewhaine/silverstripe-form-capture": ">=0.2,<=0.2.3|>=1,<1.0.2|>=2,<2.2.5", - "aoe/restler": "<1.7.1", - "apache-solr-for-typo3/solr": "<2.8.3", - "apereo/phpcas": "<1.6", - "api-platform/core": "<3.4.17|>=4,<4.0.22|>=4.1,<4.1.5", - "api-platform/graphql": "<3.4.17|>=4,<4.0.22|>=4.1,<4.1.5", - "appwrite/server-ce": "<=1.2.1", - "arc/web": "<3", - "area17/twill": "<1.2.5|>=2,<2.5.3", - "artesaos/seotools": "<0.17.2", - "asymmetricrypt/asymmetricrypt": "<9.9.99", - "athlon1600/php-proxy": "<=5.1", - "athlon1600/php-proxy-app": "<=3", - "athlon1600/youtube-downloader": "<=4", - "austintoddj/canvas": "<=3.4.2", - "auth0/auth0-php": ">=3.3,<8.18", - "auth0/login": "<7.20", - "auth0/symfony": "<=5.5", - "auth0/wordpress": "<=5.4", - "automad/automad": "<2.0.0.0-alpha5", - "automattic/jetpack": "<9.8", - "awesome-support/awesome-support": "<=6.0.7", - "aws/aws-sdk-php": "<3.368", - "azuracast/azuracast": "<=0.23.1", - "b13/seo_basics": "<0.8.2", - "backdrop/backdrop": "<=1.32", - "backpack/crud": "<3.4.9", - "backpack/filemanager": "<2.0.2|>=3,<3.0.9", - "bacula-web/bacula-web": "<9.7.1", - "badaso/core": "<=2.9.11", - "bagisto/bagisto": "<2.3.10", - "barrelstrength/sprout-base-email": "<1.2.7", - "barrelstrength/sprout-forms": "<3.9", - "barryvdh/laravel-translation-manager": "<0.6.8", - "barzahlen/barzahlen-php": "<2.0.1", - "baserproject/basercms": "<=5.1.1", - "bassjobsen/bootstrap-3-typeahead": ">4.0.2", - "bbpress/bbpress": "<2.6.5", - "bcit-ci/codeigniter": "<3.1.3", - "bcosca/fatfree": "<3.7.2", - "bedita/bedita": "<4", - "bednee/cooluri": "<1.0.30", - "bigfork/silverstripe-form-capture": ">=3,<3.1.1", - "billz/raspap-webgui": "<3.3.6", - "binarytorch/larecipe": "<2.8.1", - "bk2k/bootstrap-package": ">=7.1,<7.1.2|>=8,<8.0.8|>=9,<9.0.4|>=9.1,<9.1.3|>=10,<10.0.10|>=11,<11.0.3", - "blueimp/jquery-file-upload": "==6.4.4", - "bmarshall511/wordpress_zero_spam": "<5.2.13", - "bolt/bolt": "<3.7.2", - "bolt/core": "<=4.2", - "born05/craft-twofactorauthentication": "<3.3.4", - "bottelet/flarepoint": "<2.2.1", - "bref/bref": "<2.1.17", - "brightlocal/phpwhois": "<=4.2.5", - "brotkrueml/codehighlight": "<2.7", - "brotkrueml/schema": "<1.13.1|>=2,<2.5.1", - "brotkrueml/typo3-matomo-integration": "<1.3.2", - "buddypress/buddypress": "<7.2.1", - "bugsnag/bugsnag-laravel": ">=2,<2.0.2", - "bvbmedia/multishop": "<2.0.39", - "bytefury/crater": "<6.0.2", - "cachethq/cachet": "<2.5.1", - "cadmium-org/cadmium-cms": "<=0.4.9", - "cakephp/cakephp": "<3.10.3|>=4,<4.0.10|>=4.1,<4.1.4|>=4.2,<4.2.12|>=4.3,<4.3.11|>=4.4,<4.4.10|>=5.2.10,<5.2.12|==5.3", - "cakephp/database": ">=4.2,<4.2.12|>=4.3,<4.3.11|>=4.4,<4.4.10", - "cardgate/magento2": "<2.0.33", - "cardgate/woocommerce": "<=3.1.15", - "cart2quote/module-quotation": ">=4.1.6,<=4.4.5|>=5,<5.4.4", - "cart2quote/module-quotation-encoded": ">=4.1.6,<=4.4.5|>=5,<5.4.4", - "cartalyst/sentry": "<=2.1.6", - "catfan/medoo": "<1.7.5", - "causal/oidc": "<4", - "cecil/cecil": "<7.47.1", - "centreon/centreon": "<22.10.15", - "cesnet/simplesamlphp-module-proxystatistics": "<3.1", - "chriskacerguis/codeigniter-restserver": "<=2.7.1", - "chrome-php/chrome": "<1.14", - "civicrm/civicrm-core": ">=4.2,<4.2.9|>=4.3,<4.3.3", - "ckeditor/ckeditor": "<4.25", - "clickstorm/cs-seo": ">=6,<6.8|>=7,<7.5|>=8,<8.4|>=9,<9.3", - "co-stack/fal_sftp": "<0.2.6", - "cockpit-hq/cockpit": "<2.11.4", - "code16/sharp": "<9.11.1", - "codeception/codeception": "<3.1.3|>=4,<4.1.22", - "codeigniter/framework": "<3.1.10", - "codeigniter4/framework": "<4.6.2", - "codeigniter4/shield": "<1.0.0.0-beta8", - "codiad/codiad": "<=2.8.4", - "codingms/additional-tca": ">=1.7,<1.15.17|>=1.16,<1.16.9", - "codingms/modules": "<4.3.11|>=5,<5.7.4|>=6,<6.4.2|>=7,<7.5.5", - "commerceteam/commerce": ">=0.9.6,<0.9.9", - "components/jquery": ">=1.0.3,<3.5", - "composer/composer": "<1.10.27|>=2,<2.2.26|>=2.3,<2.9.3", - "concrete5/concrete5": "<9.4.3", - "concrete5/core": "<8.5.8|>=9,<9.1", - "contao-components/mediaelement": ">=2.14.2,<2.21.1", - "contao/comments-bundle": ">=2,<4.13.40|>=5.0.0.0-RC1-dev,<5.3.4", - "contao/contao": ">=3,<3.5.37|>=4,<4.4.56|>=4.5,<4.13.56|>=5,<5.3.38|>=5.4.0.0-RC1-dev,<5.6.1", - "contao/core": "<3.5.39", - "contao/core-bundle": "<4.13.57|>=5,<5.3.42|>=5.4,<5.6.5", - "contao/listing-bundle": ">=3,<=3.5.30|>=4,<4.4.8", - "contao/managed-edition": "<=1.5", - "coreshop/core-shop": "<4.1.9", - "corveda/phpsandbox": "<1.3.5", - "cosenary/instagram": "<=2.3", - "couleurcitron/tarteaucitron-wp": "<0.3", - "cpsit/typo3-mailqueue": "<0.4.3|>=0.5,<0.5.1", - "craftcms/cms": "<=4.16.16|>=5,<=5.8.20", - "croogo/croogo": "<=4.0.7", - "cuyz/valinor": "<0.12", - "czim/file-handling": "<1.5|>=2,<2.3", - "czproject/git-php": "<4.0.3", - "damienharper/auditor-bundle": "<5.2.6", - "dapphp/securimage": "<3.6.6", - "darylldoyle/safe-svg": "<1.9.10", - "datadog/dd-trace": ">=0.30,<0.30.2", - "datahihi1/tiny-env": "<1.0.3|>=1.0.9,<1.0.11", - "datatables/datatables": "<1.10.10", - "david-garcia/phpwhois": "<=4.3.1", - "dbrisinajumi/d2files": "<1", - "dcat/laravel-admin": "<=2.1.3|==2.2.0.0-beta|==2.2.2.0-beta", - "derhansen/fe_change_pwd": "<2.0.5|>=3,<3.0.3", - "derhansen/sf_event_mgt": "<4.3.1|>=5,<5.1.1|>=7,<7.4", - "desperado/xml-bundle": "<=0.1.7", - "dev-lancer/minecraft-motd-parser": "<=1.0.5", - "devcode-it/openstamanager": "<=2.9.4", - "devgroup/dotplant": "<2020.09.14-dev", - "digimix/wp-svg-upload": "<=1", - "directmailteam/direct-mail": "<6.0.3|>=7,<7.0.3|>=8,<9.5.2", - "dl/yag": "<3.0.1", - "dmk/webkitpdf": "<1.1.4", - "dnadesign/silverstripe-elemental": "<5.3.12", - "doctrine/annotations": "<1.2.7", - "doctrine/cache": ">=1,<1.3.2|>=1.4,<1.4.2", - "doctrine/common": "<2.4.3|>=2.5,<2.5.1", - "doctrine/dbal": ">=2,<2.0.8|>=2.1,<2.1.2|>=3,<3.1.4", - "doctrine/doctrine-bundle": "<1.5.2", - "doctrine/doctrine-module": "<0.7.2", - "doctrine/mongodb-odm": "<1.0.2", - "doctrine/mongodb-odm-bundle": "<3.0.1", - "doctrine/orm": ">=1,<1.2.4|>=2,<2.4.8|>=2.5,<2.5.1|>=2.8.3,<2.8.4", - "dolibarr/dolibarr": "<21.0.3", - "dompdf/dompdf": "<2.0.4", - "doublethreedigital/guest-entries": "<3.1.2", - "drupal-pattern-lab/unified-twig-extensions": "<=0.1", - "drupal/access_code": "<2.0.5", - "drupal/acquia_dam": "<1.1.5", - "drupal/admin_audit_trail": "<1.0.5", - "drupal/ai": "<1.0.5", - "drupal/alogin": "<2.0.6", - "drupal/cache_utility": "<1.2.1", - "drupal/civictheme": "<1.12", - "drupal/commerce_alphabank_redirect": "<1.0.3", - "drupal/commerce_eurobank_redirect": "<2.1.1", - "drupal/config_split": "<1.10|>=2,<2.0.2", - "drupal/core": ">=6,<6.38|>=7,<7.103|>=8,<10.4.9|>=10.5,<10.5.6|>=11,<11.1.9|>=11.2,<11.2.8", - "drupal/core-recommended": ">=7,<7.102|>=8,<10.2.11|>=10.3,<10.3.9|>=11,<11.0.8", - "drupal/currency": "<3.5", - "drupal/drupal": ">=5,<5.11|>=6,<6.38|>=7,<7.102|>=8,<10.2.11|>=10.3,<10.3.9|>=11,<11.0.8", - "drupal/email_tfa": "<2.0.6", - "drupal/formatter_suite": "<2.1", - "drupal/gdpr": "<3.0.1|>=3.1,<3.1.2", - "drupal/google_tag": "<1.8|>=2,<2.0.8", - "drupal/ignition": "<1.0.4", - "drupal/json_field": "<1.5", - "drupal/lightgallery": "<1.6", - "drupal/link_field_display_mode_formatter": "<1.6", - "drupal/matomo": "<1.24", - "drupal/oauth2_client": "<4.1.3", - "drupal/oauth2_server": "<2.1", - "drupal/obfuscate": "<2.0.1", - "drupal/plausible_tracking": "<1.0.2", - "drupal/quick_node_block": "<2", - "drupal/rapidoc_elements_field_formatter": "<1.0.1", - "drupal/reverse_proxy_header": "<1.1.2", - "drupal/simple_multistep": "<2", - "drupal/simple_oauth": ">=6,<6.0.7", - "drupal/spamspan": "<3.2.1", - "drupal/tfa": "<1.10", - "drupal/umami_analytics": "<1.0.1", - "duncanmcclean/guest-entries": "<3.1.2", - "dweeves/magmi": "<=0.7.24", - "ec-cube/ec-cube": "<2.4.4|>=2.11,<=2.17.1|>=3,<=3.0.18.0-patch4|>=4,<=4.1.2", - "ecodev/newsletter": "<=4", - "ectouch/ectouch": "<=2.7.2", - "egroupware/egroupware": "<23.1.20260113|>=26.0.20251208,<26.0.20260113", - "elefant/cms": "<2.0.7", - "elgg/elgg": "<3.3.24|>=4,<4.0.5", - "elijaa/phpmemcacheadmin": "<=1.3", - "elmsln/haxcms": "<11.0.14", - "encore/laravel-admin": "<=1.8.19", - "endroid/qr-code-bundle": "<3.4.2", - "enhavo/enhavo-app": "<=0.13.1", - "enshrined/svg-sanitize": "<0.22", - "erusev/parsedown": "<1.7.2", - "ether/logs": "<3.0.4", - "evolutioncms/evolution": "<=3.2.3", - "exceedone/exment": "<4.4.3|>=5,<5.0.3", - "exceedone/laravel-admin": "<2.2.3|==3", - "ezsystems/demobundle": ">=5.4,<5.4.6.1-dev", - "ezsystems/ez-support-tools": ">=2.2,<2.2.3", - "ezsystems/ezdemo-ls-extension": ">=5.4,<5.4.2.1-dev", - "ezsystems/ezfind-ls": ">=5.3,<5.3.6.1-dev|>=5.4,<5.4.11.1-dev|>=2017.12,<2017.12.0.1-dev", - "ezsystems/ezplatform": "<=1.13.6|>=2,<=2.5.24", - "ezsystems/ezplatform-admin-ui": ">=1.3,<1.3.5|>=1.4,<1.4.6|>=1.5,<1.5.29|>=2.3,<2.3.39|>=3.3,<3.3.39", - "ezsystems/ezplatform-admin-ui-assets": ">=4,<4.2.1|>=5,<5.0.1|>=5.1,<5.1.1|>=5.3.0.0-beta1,<5.3.5", - "ezsystems/ezplatform-graphql": ">=1.0.0.0-RC1-dev,<1.0.13|>=2.0.0.0-beta1,<2.3.12", - "ezsystems/ezplatform-http-cache": "<2.3.16", - "ezsystems/ezplatform-kernel": "<1.2.5.1-dev|>=1.3,<1.3.35", - "ezsystems/ezplatform-rest": ">=1.2,<=1.2.2|>=1.3,<1.3.8", - "ezsystems/ezplatform-richtext": ">=2.3,<2.3.26|>=3.3,<3.3.40", - "ezsystems/ezplatform-solr-search-engine": ">=1.7,<1.7.12|>=2,<2.0.2|>=3.3,<3.3.15", - "ezsystems/ezplatform-user": ">=1,<1.0.1", - "ezsystems/ezpublish-kernel": "<6.13.8.2-dev|>=7,<7.5.31", - "ezsystems/ezpublish-legacy": "<=2017.12.7.3|>=2018.6,<=2019.03.5.1", - "ezsystems/platform-ui-assets-bundle": ">=4.2,<4.2.3", - "ezsystems/repository-forms": ">=2.3,<2.3.2.1-dev|>=2.5,<2.5.15", - "ezyang/htmlpurifier": "<=4.2", - "facade/ignition": "<1.16.15|>=2,<2.4.2|>=2.5,<2.5.2", - "facturascripts/facturascripts": "<=2025.4|==2025.11|==2025.41|==2025.43", - "fastly/magento2": "<1.2.26", - "feehi/cms": "<=2.1.1", - "feehi/feehicms": "<=2.1.1", - "fenom/fenom": "<=2.12.1", - "filament/actions": ">=3.2,<3.2.123", - "filament/filament": ">=4,<4.3.1", - "filament/infolists": ">=3,<3.2.115", - "filament/tables": ">=3,<3.2.115", - "filegator/filegator": "<7.8", - "filp/whoops": "<2.1.13", - "fineuploader/php-traditional-server": "<=1.2.2", - "firebase/php-jwt": "<6", - "fisharebest/webtrees": "<=2.1.18", - "fixpunkt/fp-masterquiz": "<2.2.1|>=3,<3.5.2", - "fixpunkt/fp-newsletter": "<1.1.1|>=1.2,<2.1.2|>=2.2,<3.2.6", - "flarum/core": "<1.8.10", - "flarum/flarum": "<0.1.0.0-beta8", - "flarum/framework": "<1.8.10", - "flarum/mentions": "<1.6.3", - "flarum/sticky": ">=0.1.0.0-beta14,<=0.1.0.0-beta15", - "flarum/tags": "<=0.1.0.0-beta13", - "floriangaerber/magnesium": "<0.3.1", - "fluidtypo3/vhs": "<5.1.1", - "fof/byobu": ">=0.3.0.0-beta2,<1.1.7", - "fof/pretty-mail": "<=1.1.2", - "fof/upload": "<1.2.3", - "foodcoopshop/foodcoopshop": ">=3.2,<3.6.1", - "fooman/tcpdf": "<6.2.22", - "forkcms/forkcms": "<5.11.1", - "fossar/tcpdf-parser": "<6.2.22", - "francoisjacquet/rosariosis": "<=11.5.1", - "frappant/frp-form-answers": "<3.1.2|>=4,<4.0.2", - "friendsofsymfony/oauth2-php": "<1.3", - "friendsofsymfony/rest-bundle": ">=1.2,<1.2.2", - "friendsofsymfony/user-bundle": ">=1,<1.3.5", - "friendsofsymfony1/swiftmailer": ">=4,<5.4.13|>=6,<6.2.5", - "friendsofsymfony1/symfony1": ">=1.1,<1.5.19", - "friendsoftypo3/mediace": ">=7.6.2,<7.6.5", - "friendsoftypo3/openid": ">=4.5,<4.5.31|>=4.7,<4.7.16|>=6,<6.0.11|>=6.1,<6.1.6", - "froala/wysiwyg-editor": "<=4.3", - "froxlor/froxlor": "<=2.2.5", - "frozennode/administrator": "<=5.0.12", - "fuel/core": "<1.8.1", - "funadmin/funadmin": "<=5.0.2", - "gaoming13/wechat-php-sdk": "<=1.10.2", - "genix/cms": "<=1.1.11", - "georgringer/news": "<1.3.3", - "geshi/geshi": "<=1.0.9.1", - "getformwork/formwork": "<2.2", - "getgrav/grav": "<1.11.0.0-beta1", - "getkirby/cms": "<3.9.8.3-dev|>=3.10,<3.10.1.2-dev|>=4,<4.7.1|>=5,<=5.2.1", - "getkirby/kirby": "<3.9.8.3-dev|>=3.10,<3.10.1.2-dev|>=4,<4.7.1", - "getkirby/panel": "<2.5.14", - "getkirby/starterkit": "<=3.7.0.2", - "gilacms/gila": "<=1.15.4", - "gleez/cms": "<=1.3|==2", - "globalpayments/php-sdk": "<2", - "goalgorilla/open_social": "<12.3.11|>=12.4,<12.4.10|>=13.0.0.0-alpha1,<13.0.0.0-alpha11", - "gogentooss/samlbase": "<1.2.7", - "google/protobuf": "<3.4", - "gos/web-socket-bundle": "<1.10.4|>=2,<2.6.1|>=3,<3.3", - "gp247/core": "<1.1.24", - "gree/jose": "<2.2.1", - "gregwar/rst": "<1.0.3", - "grumpydictator/firefly-iii": "<6.1.17", - "gugoan/economizzer": "<=0.9.0.0-beta1", - "guzzlehttp/guzzle": "<6.5.8|>=7,<7.4.5", - "guzzlehttp/oauth-subscriber": "<0.8.1", - "guzzlehttp/psr7": "<1.9.1|>=2,<2.4.5", - "haffner/jh_captcha": "<=2.1.3|>=3,<=3.0.2", - "handcraftedinthealps/goodby-csv": "<1.4.3", - "harvesthq/chosen": "<1.8.7", - "helloxz/imgurl": "<=2.31", - "hhxsv5/laravel-s": "<3.7.36", - "hillelcoren/invoice-ninja": "<5.3.35", - "himiklab/yii2-jqgrid-widget": "<1.0.8", - "hjue/justwriting": "<=1", - "hov/jobfair": "<1.0.13|>=2,<2.0.2", - "httpsoft/http-message": "<1.0.12", - "hyn/multi-tenant": ">=5.6,<5.7.2", - "ibexa/admin-ui": ">=4.2,<4.2.3|>=4.6,<4.6.25|>=5,<5.0.3", - "ibexa/admin-ui-assets": ">=4.6.0.0-alpha1,<4.6.21", - "ibexa/core": ">=4,<4.0.7|>=4.1,<4.1.4|>=4.2,<4.2.3|>=4.5,<4.5.6|>=4.6,<4.6.2", - "ibexa/fieldtype-richtext": ">=4.6,<4.6.25|>=5,<5.0.3", - "ibexa/graphql": ">=2.5,<2.5.31|>=3.3,<3.3.28|>=4.2,<4.2.3", - "ibexa/http-cache": ">=4.6,<4.6.14", - "ibexa/post-install": "<1.0.16|>=4.6,<4.6.14", - "ibexa/solr": ">=4.5,<4.5.4", - "ibexa/user": ">=4,<4.4.3|>=5,<5.0.4", - "icecoder/icecoder": "<=8.1", - "idno/known": "<=1.3.1", - "ilicmiljan/secure-props": ">=1.2,<1.2.2", - "illuminate/auth": "<5.5.10", - "illuminate/cookie": ">=4,<=4.0.11|>=4.1,<6.18.31|>=7,<7.22.4", - "illuminate/database": "<6.20.26|>=7,<7.30.5|>=8,<8.40", - "illuminate/encryption": ">=4,<=4.0.11|>=4.1,<=4.1.31|>=4.2,<=4.2.22|>=5,<=5.0.35|>=5.1,<=5.1.46|>=5.2,<=5.2.45|>=5.3,<=5.3.31|>=5.4,<=5.4.36|>=5.5,<5.5.40|>=5.6,<5.6.15", - "illuminate/view": "<6.20.42|>=7,<7.30.6|>=8,<8.75", - "imdbphp/imdbphp": "<=5.1.1", - "impresscms/impresscms": "<=1.4.5", - "impresspages/impresspages": "<1.0.13", - "in2code/femanager": "<6.4.2|>=7,<7.5.3|>=8,<8.3.1", - "in2code/ipandlanguageredirect": "<5.1.2", - "in2code/lux": "<17.6.1|>=18,<24.0.2", - "in2code/powermail": "<7.5.1|>=8,<8.5.1|>=9,<10.9.1|>=11,<12.5.3|==13", - "innologi/typo3-appointments": "<2.0.6", - "intelliants/subrion": "<4.2.2", - "inter-mediator/inter-mediator": "==5.5", - "ipl/web": "<0.10.1", - "islandora/crayfish": "<4.1", - "islandora/islandora": ">=2,<2.4.1", - "ivankristianto/phpwhois": "<=4.3", - "jackalope/jackalope-doctrine-dbal": "<1.7.4", - "jambagecom/div2007": "<0.10.2", - "james-heinrich/getid3": "<1.9.21", - "james-heinrich/phpthumb": "<=1.7.23", - "jasig/phpcas": "<1.3.3", - "jbartels/wec-map": "<3.0.3", - "jcbrand/converse.js": "<3.3.3", - "joelbutcher/socialstream": "<5.6|>=6,<6.2", - "johnbillion/wp-crontrol": "<1.16.2|>=1.17,<1.19.2", - "joomla/application": "<1.0.13", - "joomla/archive": "<1.1.12|>=2,<2.0.1", - "joomla/database": ">=1,<2.2|>=3,<3.4", - "joomla/filesystem": "<1.6.2|>=2,<2.0.1", - "joomla/filter": "<2.0.6|>=3,<3.0.5|==4", - "joomla/framework": "<1.5.7|>=2.5.4,<=3.8.12", - "joomla/input": ">=2,<2.0.2", - "joomla/joomla-cms": "<3.9.12|>=4,<4.4.13|>=5,<5.2.6", - "joomla/joomla-platform": "<1.5.4", - "joomla/session": "<1.3.1", - "joyqi/hyper-down": "<=2.4.27", - "jsdecena/laracom": "<2.0.9", - "jsmitty12/phpwhois": "<5.1", - "juzaweb/cms": "<=3.4.2", - "jweiland/events2": "<8.3.8|>=9,<9.0.6", - "jweiland/kk-downloader": "<1.2.2", - "kazist/phpwhois": "<=4.2.6", - "kelvinmo/simplexrd": "<3.1.1", - "kevinpapst/kimai2": "<1.16.7", - "khodakhah/nodcms": "<=3", - "kimai/kimai": "<2.46", - "kitodo/presentation": "<3.2.3|>=3.3,<3.3.4", - "klaviyo/magento2-extension": ">=1,<3", - "knplabs/knp-snappy": "<=1.4.2", - "kohana/core": "<3.3.3", - "koillection/koillection": "<1.6.12", - "krayin/laravel-crm": "<=1.3", - "kreait/firebase-php": ">=3.2,<3.8.1", - "kumbiaphp/kumbiapp": "<=1.1.1", - "la-haute-societe/tcpdf": "<6.2.22", - "laminas/laminas-diactoros": "<2.18.1|==2.19|==2.20|==2.21|==2.22|==2.23|>=2.24,<2.24.2|>=2.25,<2.25.2", - "laminas/laminas-form": "<2.17.1|>=3,<3.0.2|>=3.1,<3.1.1", - "laminas/laminas-http": "<2.14.2", - "lara-zeus/artemis": ">=1,<=1.0.6", - "lara-zeus/dynamic-dashboard": ">=3,<=3.0.1", - "laravel/fortify": "<1.11.1", - "laravel/framework": "<10.48.29|>=11,<11.44.1|>=12,<12.1.1", - "laravel/laravel": ">=5.4,<5.4.22", - "laravel/pulse": "<1.3.1", - "laravel/reverb": "<1.7", - "laravel/socialite": ">=1,<2.0.10", - "latte/latte": "<2.10.8", - "lavalite/cms": "<=10.1", - "lavitto/typo3-form-to-database": "<2.2.5|>=3,<3.2.2|>=4,<4.2.3|>=5,<5.0.2", - "lcobucci/jwt": ">=3.4,<3.4.6|>=4,<4.0.4|>=4.1,<4.1.5", - "league/commonmark": "<2.7", - "league/flysystem": "<1.1.4|>=2,<2.1.1", - "league/oauth2-server": ">=8.3.2,<8.4.2|>=8.5,<8.5.3", - "leantime/leantime": "<3.3", - "lexik/jwt-authentication-bundle": "<2.10.7|>=2.11,<2.11.3", - "libreform/libreform": ">=2,<=2.0.8", - "librenms/librenms": "<25.12", - "liftkit/database": "<2.13.2", - "lightsaml/lightsaml": "<1.3.5", - "limesurvey/limesurvey": "<6.5.12", - "livehelperchat/livehelperchat": "<=3.91", - "livewire-filemanager/filemanager": "<=1.0.4", - "livewire/livewire": "<2.12.7|>=3.0.0.0-beta1,<3.6.4", - "livewire/volt": "<1.7", - "lms/routes": "<2.1.1", - "localizationteam/l10nmgr": "<7.4|>=8,<8.7|>=9,<9.2", - "lomkit/laravel-rest-api": "<2.13", - "luracast/restler": "<3.1", - "luyadev/yii-helpers": "<1.2.1", - "macropay-solutions/laravel-crud-wizard-free": "<3.4.17", - "maestroerror/php-heic-to-jpg": "<1.0.5", - "magento/community-edition": "<2.4.6.0-patch13|>=2.4.7.0-beta1,<2.4.7.0-patch8|>=2.4.8.0-beta1,<2.4.8.0-patch3|>=2.4.9.0-alpha1,<2.4.9.0-alpha3|==2.4.9", - "magento/core": "<=1.9.4.5", - "magento/magento1ce": "<1.9.4.3-dev", - "magento/magento1ee": ">=1,<1.14.4.3-dev", - "magento/product-community-edition": "<2.4.4.0-patch9|>=2.4.5,<2.4.5.0-patch8|>=2.4.6,<2.4.6.0-patch6|>=2.4.7,<2.4.7.0-patch1", - "magento/project-community-edition": "<=2.0.2", - "magneto/core": "<1.9.4.4-dev", - "mahocommerce/maho": "<25.9", - "maikuolan/phpmussel": ">=1,<1.6", - "mainwp/mainwp": "<=4.4.3.3", - "manogi/nova-tiptap": "<=3.2.6", - "mantisbt/mantisbt": "<2.27.2", - "marcwillmann/turn": "<0.3.3", - "marshmallow/nova-tiptap": "<5.7", - "matomo/matomo": "<1.11", - "matyhtf/framework": "<3.0.6", - "mautic/core": "<5.2.9|>=6,<6.0.7", - "mautic/core-lib": ">=1.0.0.0-beta,<4.4.13|>=5.0.0.0-alpha,<5.1.1", - "mautic/grapes-js-builder-bundle": ">=4,<4.4.18|>=5,<5.2.9|>=6,<6.0.7", - "maximebf/debugbar": "<1.19", - "mdanter/ecc": "<2", - "mediawiki/abuse-filter": "<1.39.9|>=1.40,<1.41.3|>=1.42,<1.42.2", - "mediawiki/cargo": "<3.8.3", - "mediawiki/core": "<1.39.5|==1.40", - "mediawiki/data-transfer": ">=1.39,<1.39.11|>=1.41,<1.41.3|>=1.42,<1.42.2", - "mediawiki/matomo": "<2.4.3", - "mediawiki/semantic-media-wiki": "<4.0.2", - "mehrwert/phpmyadmin": "<3.2", - "melisplatform/melis-asset-manager": "<5.0.1", - "melisplatform/melis-cms": "<5.3.4", - "melisplatform/melis-cms-slider": "<5.3.1", - "melisplatform/melis-core": "<5.3.11", - "melisplatform/melis-front": "<5.0.1", - "mezzio/mezzio-swoole": "<3.7|>=4,<4.3", - "mgallegos/laravel-jqgrid": "<=1.3", - "microsoft/microsoft-graph": ">=1.16,<1.109.1|>=2,<2.0.1", - "microsoft/microsoft-graph-beta": "<2.0.1", - "microsoft/microsoft-graph-core": "<2.0.2", - "microweber/microweber": "<=2.0.19", - "mikehaertl/php-shellcommand": "<1.6.1", - "mineadmin/mineadmin": "<=3.0.9", - "miniorange/miniorange-saml": "<1.4.3", - "mittwald/typo3_forum": "<1.2.1", - "mobiledetect/mobiledetectlib": "<2.8.32", - "modx/revolution": "<=3.1", - "mojo42/jirafeau": "<4.4", - "mongodb/mongodb": ">=1,<1.9.2", - "mongodb/mongodb-extension": "<1.21.2", - "monolog/monolog": ">=1.8,<1.12", - "moodle/moodle": "<4.4.12|>=4.5.0.0-beta,<4.5.8|>=5.0.0.0-beta,<5.0.4|>=5.1.0.0-beta,<5.1.1", - "moonshine/moonshine": "<=3.12.5", - "mos/cimage": "<0.7.19", - "movim/moxl": ">=0.8,<=0.10", - "movingbytes/social-network": "<=1.2.1", - "mpdf/mpdf": "<=7.1.7", - "munkireport/comment": "<4", - "munkireport/managedinstalls": "<2.6", - "munkireport/munki_facts": "<1.5", - "munkireport/reportdata": "<3.5", - "munkireport/softwareupdate": "<1.6", - "mustache/mustache": ">=2,<2.14.1", - "mwdelaney/wp-enable-svg": "<=0.2", - "namshi/jose": "<2.2", - "nasirkhan/laravel-starter": "<11.11", - "nategood/httpful": "<1", - "neoan3-apps/template": "<1.1.1", - "neorazorx/facturascripts": "<2022.04", - "neos/flow": ">=1,<1.0.4|>=1.1,<1.1.1|>=2,<2.0.1|>=2.3,<2.3.16|>=3,<3.0.12|>=3.1,<3.1.10|>=3.2,<3.2.13|>=3.3,<3.3.13|>=4,<4.0.6", - "neos/form": ">=1.2,<4.3.3|>=5,<5.0.9|>=5.1,<5.1.3", - "neos/media-browser": "<7.3.19|>=8,<8.0.16|>=8.1,<8.1.11|>=8.2,<8.2.11|>=8.3,<8.3.9", - "neos/neos": ">=1.1,<1.1.3|>=1.2,<1.2.13|>=2,<2.0.4|>=2.3,<3.0.20|>=3.1,<3.1.18|>=3.2,<3.2.14|>=3.3,<5.3.10|>=7,<7.0.9|>=7.1,<7.1.7|>=7.2,<7.2.6|>=7.3,<7.3.4|>=8,<8.0.2", - "neos/swiftmailer": "<5.4.5", - "nesbot/carbon": "<2.72.6|>=3,<3.8.4", - "netcarver/textile": "<=4.1.2", - "netgen/tagsbundle": ">=3.4,<3.4.11|>=4,<4.0.15", - "nette/application": ">=2,<2.0.19|>=2.1,<2.1.13|>=2.2,<2.2.10|>=2.3,<2.3.14|>=2.4,<2.4.16|>=3,<3.0.6", - "nette/nette": ">=2,<2.0.19|>=2.1,<2.1.13", - "neuron-core/neuron-ai": "<=2.8.11", - "nilsteampassnet/teampass": "<3.1.3.1-dev", - "nitsan/ns-backup": "<13.0.1", - "nonfiction/nterchange": "<4.1.1", - "notrinos/notrinos-erp": "<=0.7", - "noumo/easyii": "<=0.9", - "novaksolutions/infusionsoft-php-sdk": "<1", - "novosga/novosga": "<=2.2.12", - "nukeviet/nukeviet": "<4.5.02", - "nyholm/psr7": "<1.6.1", - "nystudio107/craft-seomatic": "<3.4.12", - "nzedb/nzedb": "<0.8", - "nzo/url-encryptor-bundle": ">=4,<4.3.2|>=5,<5.0.1", - "october/backend": "<1.1.2", - "october/cms": "<1.0.469|==1.0.469|==1.0.471|==1.1.1", - "october/october": "<3.7.5", - "october/rain": "<1.0.472|>=1.1,<1.1.2", - "october/system": "<=3.7.12|>=4,<=4.0.11", - "oliverklee/phpunit": "<3.5.15", - "omeka/omeka-s": "<4.0.3", - "onelogin/php-saml": "<2.21.1|>=3,<3.8.1|>=4,<4.3.1", - "oneup/uploader-bundle": ">=1,<1.9.3|>=2,<2.1.5", - "open-web-analytics/open-web-analytics": "<1.8.1", - "opencart/opencart": ">=0", - "openid/php-openid": "<2.3", - "openmage/magento-lts": "<20.16", - "opensolutions/vimbadmin": "<=3.0.15", - "opensource-workshop/connect-cms": "<1.8.7|>=2,<2.4.7", - "orchid/platform": ">=8,<14.43", - "oro/calendar-bundle": ">=4.2,<=4.2.6|>=5,<=5.0.6|>=5.1,<5.1.1", - "oro/commerce": ">=4.1,<5.0.11|>=5.1,<5.1.1", - "oro/crm": ">=1.7,<1.7.4|>=3.1,<4.1.17|>=4.2,<4.2.7", - "oro/crm-call-bundle": ">=4.2,<=4.2.5|>=5,<5.0.4|>=5.1,<5.1.1", - "oro/customer-portal": ">=4.1,<=4.1.13|>=4.2,<=4.2.10|>=5,<=5.0.11|>=5.1,<=5.1.3", - "oro/platform": ">=1.7,<1.7.4|>=3.1,<3.1.29|>=4.1,<4.1.17|>=4.2,<=4.2.10|>=5,<=5.0.12|>=5.1,<=5.1.3", - "oveleon/contao-cookiebar": "<1.16.3|>=2,<2.1.3", - "oxid-esales/oxideshop-ce": "<=7.0.5", - "oxid-esales/paymorrow-module": ">=1,<1.0.2|>=2,<2.0.1", - "packbackbooks/lti-1-3-php-library": "<5", - "padraic/humbug_get_contents": "<1.1.2", - "pagarme/pagarme-php": "<3", - "pagekit/pagekit": "<=1.0.18", - "paragonie/ecc": "<2.0.1", - "paragonie/random_compat": "<2", - "paragonie/sodium_compat": "<1.24|>=2,<2.5", - "passbolt/passbolt_api": "<4.6.2", - "paypal/adaptivepayments-sdk-php": "<=3.9.2", - "paypal/invoice-sdk-php": "<=3.9", - "paypal/merchant-sdk-php": "<3.12", - "paypal/permissions-sdk-php": "<=3.9.1", - "pear/archive_tar": "<1.4.14", - "pear/auth": "<1.2.4", - "pear/crypt_gpg": "<1.6.7", - "pear/http_request2": "<2.7", - "pear/pear": "<=1.10.1", - "pegasus/google-for-jobs": "<1.5.1|>=2,<2.1.1", - "personnummer/personnummer": "<3.0.2", - "ph7software/ph7builder": "<=17.9.1", - "phanan/koel": "<5.1.4", - "phenx/php-svg-lib": "<0.5.2", - "php-censor/php-censor": "<2.0.13|>=2.1,<2.1.5", - "php-mod/curl": "<2.3.2", - "phpbb/phpbb": "<3.3.11", - "phpems/phpems": ">=6,<=6.1.3", - "phpfastcache/phpfastcache": "<6.1.5|>=7,<7.1.2|>=8,<8.0.7", - "phpmailer/phpmailer": "<6.5", - "phpmussel/phpmussel": ">=1,<1.6", - "phpmyadmin/phpmyadmin": "<5.2.2", - "phpmyfaq/phpmyfaq": "<=4.0.16", - "phpoffice/common": "<0.2.9", - "phpoffice/math": "<=0.2", - "phpoffice/phpexcel": "<=1.8.2", - "phpoffice/phpspreadsheet": "<1.30|>=2,<2.1.12|>=2.2,<2.4|>=3,<3.10|>=4,<5", - "phppgadmin/phppgadmin": "<=7.13", - "phpseclib/phpseclib": "<2.0.47|>=3,<3.0.36", - "phpservermon/phpservermon": "<3.6", - "phpsysinfo/phpsysinfo": "<3.4.3", - "phpunit/phpunit": "<8.5.52|>=9,<9.6.33|>=10,<10.5.62|>=11,<11.5.50|>=12,<12.5.8", - "phpwhois/phpwhois": "<=4.2.5", - "phpxmlrpc/extras": "<0.6.1", - "phpxmlrpc/phpxmlrpc": "<4.9.2", - "pi/pi": "<=2.5", - "pimcore/admin-ui-classic-bundle": "<=1.7.15|>=2.0.0.0-RC1-dev,<=2.2.2", - "pimcore/customer-management-framework-bundle": "<4.2.1", - "pimcore/data-hub": "<1.2.4", - "pimcore/data-importer": "<1.8.9|>=1.9,<1.9.3", - "pimcore/demo": "<10.3", - "pimcore/ecommerce-framework-bundle": "<1.0.10", - "pimcore/perspective-editor": "<1.5.1", - "pimcore/pimcore": "<=11.5.13|>=12.0.0.0-RC1-dev,<12.3.1", - "pimcore/web2print-tools-bundle": "<=5.2.1|>=6.0.0.0-RC1-dev,<=6.1", - "piwik/piwik": "<1.11", - "pixelfed/pixelfed": "<0.12.5", - "plotly/plotly.js": "<2.25.2", - "pocketmine/bedrock-protocol": "<8.0.2", - "pocketmine/pocketmine-mp": "<5.32.1", - "pocketmine/raklib": ">=0.14,<0.14.6|>=0.15,<0.15.1", - "pressbooks/pressbooks": "<5.18", - "prestashop/autoupgrade": ">=4,<4.10.1", - "prestashop/blockreassurance": "<=5.1.3", - "prestashop/blockwishlist": ">=2,<2.1.1", - "prestashop/contactform": ">=1.0.1,<4.3", - "prestashop/gamification": "<2.3.2", - "prestashop/prestashop": "<8.2.3", - "prestashop/productcomments": "<5.0.2", - "prestashop/ps_checkout": "<4.4.1|>=5,<5.0.5", - "prestashop/ps_contactinfo": "<=3.3.2", - "prestashop/ps_emailsubscription": "<2.6.1", - "prestashop/ps_facetedsearch": "<3.4.1", - "prestashop/ps_linklist": "<3.1", - "privatebin/privatebin": "<1.4|>=1.5,<1.7.4|>=1.7.7,<2.0.3", - "processwire/processwire": "<=3.0.246", - "propel/propel": ">=2.0.0.0-alpha1,<=2.0.0.0-alpha7", - "propel/propel1": ">=1,<=1.7.1", - "psy/psysh": "<=0.11.22|>=0.12,<=0.12.18", - "pterodactyl/panel": "<1.12", - "ptheofan/yii2-statemachine": ">=2.0.0.0-RC1-dev,<=2", - "ptrofimov/beanstalk_console": "<1.7.14", - "pubnub/pubnub": "<6.1", - "punktde/pt_extbase": "<1.5.1", - "pusher/pusher-php-server": "<2.2.1", - "pwweb/laravel-core": "<=0.3.6.0-beta", - "pxlrbt/filament-excel": "<1.1.14|>=2.0.0.0-alpha,<2.3.3", - "pyrocms/pyrocms": "<=3.9.1", - "qcubed/qcubed": "<=3.1.1", - "quickapps/cms": "<=2.0.0.0-beta2", - "rainlab/blog-plugin": "<1.4.1", - "rainlab/debugbar-plugin": "<3.1", - "rainlab/user-plugin": "<=1.4.5", - "rankmath/seo-by-rank-math": "<=1.0.95", - "rap2hpoutre/laravel-log-viewer": "<0.13", - "react/http": ">=0.7,<1.9", - "really-simple-plugins/complianz-gdpr": "<6.4.2", - "redaxo/source": "<=5.20.1", - "remdex/livehelperchat": "<4.29", - "renolit/reint-downloadmanager": "<4.0.2|>=5,<5.0.1", - "reportico-web/reportico": "<=8.1", - "rhukster/dom-sanitizer": "<1.0.7", - "rmccue/requests": ">=1.6,<1.8", - "robrichards/xmlseclibs": "<=3.1.3", - "roots/soil": "<4.1", - "roundcube/roundcubemail": "<1.5.10|>=1.6,<1.6.11", - "rudloff/alltube": "<3.0.3", - "rudloff/rtmpdump-bin": "<=2.3.1", - "s-cart/core": "<=9.0.5", - "s-cart/s-cart": "<6.9", - "sabberworm/php-css-parser": ">=1,<1.0.1|>=2,<2.0.1|>=3,<3.0.1|>=4,<4.0.1|>=5,<5.0.9|>=5.1,<5.1.3|>=5.2,<5.2.1|>=6,<6.0.2|>=7,<7.0.4|>=8,<8.0.1|>=8.1,<8.1.1|>=8.2,<8.2.1|>=8.3,<8.3.1", - "sabre/dav": ">=1.6,<1.7.11|>=1.8,<1.8.9", - "samwilson/unlinked-wikibase": "<1.42", - "scheb/two-factor-bundle": "<3.26|>=4,<4.11", - "sensiolabs/connect": "<4.2.3", - "serluck/phpwhois": "<=4.2.6", - "setasign/fpdi": "<2.6.4", - "sfroemken/url_redirect": "<=1.2.1", - "sheng/yiicms": "<1.2.1", - "shopware/core": "<6.6.10.9-dev|>=6.7,<6.7.6.1-dev", - "shopware/platform": "<6.6.10.7-dev|>=6.7,<6.7.3.1-dev", - "shopware/production": "<=6.3.5.2", - "shopware/shopware": "<=5.7.17|>=6.4.6,<6.6.10.10-dev|>=6.7,<6.7.6.1-dev", - "shopware/storefront": "<6.6.10.10-dev|>=6.7,<6.7.5.1-dev", - "shopxo/shopxo": "<=6.4", - "showdoc/showdoc": "<2.10.4", - "shuchkin/simplexlsx": ">=1.0.12,<1.1.13", - "silverstripe-australia/advancedreports": ">=1,<=2", - "silverstripe/admin": "<1.13.19|>=2,<2.1.8", - "silverstripe/assets": ">=1,<1.11.1", - "silverstripe/cms": "<4.11.3", - "silverstripe/comments": ">=1.3,<3.1.1", - "silverstripe/forum": "<=0.6.1|>=0.7,<=0.7.3", - "silverstripe/framework": "<5.3.23", - "silverstripe/graphql": ">=2,<2.0.5|>=3,<3.8.2|>=4,<4.3.7|>=5,<5.1.3", - "silverstripe/hybridsessions": ">=1,<2.4.1|>=2.5,<2.5.1", - "silverstripe/recipe-cms": ">=4.5,<4.5.3", - "silverstripe/registry": ">=2.1,<2.1.2|>=2.2,<2.2.1", - "silverstripe/reports": "<5.2.3", - "silverstripe/restfulserver": ">=1,<1.0.9|>=2,<2.0.4|>=2.1,<2.1.2", - "silverstripe/silverstripe-omnipay": "<2.5.2|>=3,<3.0.2|>=3.1,<3.1.4|>=3.2,<3.2.1", - "silverstripe/subsites": ">=2,<2.6.1", - "silverstripe/taxonomy": ">=1.3,<1.3.1|>=2,<2.0.1", - "silverstripe/userforms": "<3|>=5,<5.4.2", - "silverstripe/versioned-admin": ">=1,<1.11.1", - "simogeo/filemanager": "<=2.5", - "simple-updates/phpwhois": "<=1", - "simplesamlphp/saml2": "<=4.16.15|>=5.0.0.0-alpha1,<=5.0.0.0-alpha19", - "simplesamlphp/saml2-legacy": "<=4.16.15", - "simplesamlphp/simplesamlphp": "<1.18.6", - "simplesamlphp/simplesamlphp-module-infocard": "<1.0.1", - "simplesamlphp/simplesamlphp-module-openid": "<1", - "simplesamlphp/simplesamlphp-module-openidprovider": "<0.9", - "simplesamlphp/xml-common": "<1.20", - "simplesamlphp/xml-security": "==1.6.11", - "simplito/elliptic-php": "<1.0.6", - "sitegeist/fluid-components": "<3.5", - "sjbr/sr-feuser-register": "<2.6.2|>=5.1,<12.5", - "sjbr/sr-freecap": "<2.4.6|>=2.5,<2.5.3", - "sjbr/static-info-tables": "<2.3.1", - "slim/psr7": "<1.4.1|>=1.5,<1.5.1|>=1.6,<1.6.1", - "slim/slim": "<2.6", - "slub/slub-events": "<3.0.3", - "smarty/smarty": "<4.5.3|>=5,<5.1.1", - "snipe/snipe-it": "<=8.3.4", - "socalnick/scn-social-auth": "<1.15.2", - "socialiteproviders/steam": "<1.1", - "solspace/craft-freeform": "<4.1.29|>=5,<=5.14.6", - "soosyze/soosyze": "<=2", - "spatie/browsershot": "<5.0.5", - "spatie/image-optimizer": "<1.7.3", - "spencer14420/sp-php-email-handler": "<1", - "spipu/html2pdf": "<5.2.8", - "spiral/roadrunner": "<2025.1", - "spoon/library": "<1.4.1", - "spoonity/tcpdf": "<6.2.22", - "squizlabs/php_codesniffer": ">=1,<2.8.1|>=3,<3.0.1", - "ssddanbrown/bookstack": "<24.05.1", - "starcitizentools/citizen-skin": ">=1.9.4,<3.9", - "starcitizentools/short-description": ">=4,<4.0.1", - "starcitizentools/tabber-neue": ">=1.9.1,<2.7.2|>=3,<3.1.1", - "starcitizenwiki/embedvideo": "<=4", - "statamic/cms": "<=5.22", - "stormpath/sdk": "<9.9.99", - "studio-42/elfinder": "<=2.1.64", - "studiomitte/friendlycaptcha": "<0.1.4", - "subhh/libconnect": "<7.0.8|>=8,<8.1", - "sukohi/surpass": "<1", - "sulu/form-bundle": ">=2,<2.5.3", - "sulu/sulu": "<1.6.44|>=2,<2.5.25|>=2.6,<2.6.9|>=3.0.0.0-alpha1,<3.0.0.0-alpha3", - "sumocoders/framework-user-bundle": "<1.4", - "superbig/craft-audit": "<3.0.2", - "svewap/a21glossary": "<=0.4.10", - "swag/paypal": "<5.4.4", - "swiftmailer/swiftmailer": "<6.2.5", - "swiftyedit/swiftyedit": "<1.2", - "sylius/admin-bundle": ">=1,<1.0.17|>=1.1,<1.1.9|>=1.2,<1.2.2", - "sylius/grid": ">=1,<1.1.19|>=1.2,<1.2.18|>=1.3,<1.3.13|>=1.4,<1.4.5|>=1.5,<1.5.1", - "sylius/grid-bundle": "<1.10.1", - "sylius/paypal-plugin": "<1.6.2|>=1.7,<1.7.2|>=2,<2.0.2", - "sylius/resource-bundle": ">=1,<1.3.14|>=1.4,<1.4.7|>=1.5,<1.5.2|>=1.6,<1.6.4", - "sylius/sylius": "<1.12.19|>=1.13.0.0-alpha1,<1.13.4", - "symbiote/silverstripe-multivaluefield": ">=3,<3.1", - "symbiote/silverstripe-queuedjobs": ">=3,<3.0.2|>=3.1,<3.1.4|>=4,<4.0.7|>=4.1,<4.1.2|>=4.2,<4.2.4|>=4.3,<4.3.3|>=4.4,<4.4.3|>=4.5,<4.5.1|>=4.6,<4.6.4", - "symbiote/silverstripe-seed": "<6.0.3", - "symbiote/silverstripe-versionedfiles": "<=2.0.3", - "symfont/process": ">=0", - "symfony/cache": ">=3.1,<3.4.35|>=4,<4.2.12|>=4.3,<4.3.8", - "symfony/dependency-injection": ">=2,<2.0.17|>=2.7,<2.7.51|>=2.8,<2.8.50|>=3,<3.4.26|>=4,<4.1.12|>=4.2,<4.2.7", - "symfony/error-handler": ">=4.4,<4.4.4|>=5,<5.0.4", - "symfony/form": ">=2.3,<2.3.35|>=2.4,<2.6.12|>=2.7,<2.7.50|>=2.8,<2.8.49|>=3,<3.4.20|>=4,<4.0.15|>=4.1,<4.1.9|>=4.2,<4.2.1", - "symfony/framework-bundle": ">=2,<2.3.18|>=2.4,<2.4.8|>=2.5,<2.5.2|>=2.7,<2.7.51|>=2.8,<2.8.50|>=3,<3.4.26|>=4,<4.1.12|>=4.2,<4.2.7|>=5.3.14,<5.3.15|>=5.4.3,<5.4.4|>=6.0.3,<6.0.4", - "symfony/http-client": ">=4.3,<5.4.47|>=6,<6.4.15|>=7,<7.1.8", - "symfony/http-foundation": "<5.4.50|>=6,<6.4.29|>=7,<7.3.7", - "symfony/http-kernel": ">=2,<4.4.50|>=5,<5.4.20|>=6,<6.0.20|>=6.1,<6.1.12|>=6.2,<6.2.6", - "symfony/intl": ">=2.7,<2.7.38|>=2.8,<2.8.31|>=3,<3.2.14|>=3.3,<3.3.13", - "symfony/maker-bundle": ">=1.27,<1.29.2|>=1.30,<1.31.1", - "symfony/mime": ">=4.3,<4.3.8", - "symfony/phpunit-bridge": ">=2.8,<2.8.50|>=3,<3.4.26|>=4,<4.1.12|>=4.2,<4.2.7", - "symfony/polyfill": ">=1,<1.10", - "symfony/polyfill-php55": ">=1,<1.10", - "symfony/process": "<5.4.51|>=6,<6.4.33|>=7,<7.1.7|>=7.3,<7.3.11|>=7.4,<7.4.5|>=8,<8.0.5", - "symfony/proxy-manager-bridge": ">=2.7,<2.7.51|>=2.8,<2.8.50|>=3,<3.4.26|>=4,<4.1.12|>=4.2,<4.2.7", - "symfony/routing": ">=2,<2.0.19", - "symfony/runtime": ">=5.3,<5.4.46|>=6,<6.4.14|>=7,<7.1.7", - "symfony/security": ">=2,<2.7.51|>=2.8,<3.4.49|>=4,<4.4.24|>=5,<5.2.8", - "symfony/security-bundle": ">=2,<4.4.50|>=5,<5.4.20|>=6,<6.0.20|>=6.1,<6.1.12|>=6.2,<6.4.10|>=7,<7.0.10|>=7.1,<7.1.3", - "symfony/security-core": ">=2.4,<2.6.13|>=2.7,<2.7.9|>=2.7.30,<2.7.32|>=2.8,<3.4.49|>=4,<4.4.24|>=5,<5.2.9", - "symfony/security-csrf": ">=2.4,<2.7.48|>=2.8,<2.8.41|>=3,<3.3.17|>=3.4,<3.4.11|>=4,<4.0.11", - "symfony/security-guard": ">=2.8,<3.4.48|>=4,<4.4.23|>=5,<5.2.8", - "symfony/security-http": ">=2.3,<2.3.41|>=2.4,<2.7.51|>=2.8,<2.8.50|>=3,<3.4.26|>=4,<4.2.12|>=4.3,<4.3.8|>=4.4,<4.4.7|>=5,<5.0.7|>=5.1,<5.2.8|>=5.3,<5.4.47|>=6,<6.4.15|>=7,<7.1.8", - "symfony/serializer": ">=2,<2.0.11|>=4.1,<4.4.35|>=5,<5.3.12", - "symfony/symfony": "<5.4.51|>=6,<6.4.33|>=7,<7.3.11|>=7.4,<7.4.5|>=8,<8.0.5", - "symfony/translation": ">=2,<2.0.17", - "symfony/twig-bridge": ">=2,<4.4.51|>=5,<5.4.31|>=6,<6.3.8", - "symfony/ux-autocomplete": "<2.11.2", - "symfony/ux-live-component": "<2.25.1", - "symfony/ux-twig-component": "<2.25.1", - "symfony/validator": "<5.4.43|>=6,<6.4.11|>=7,<7.1.4", - "symfony/var-exporter": ">=4.2,<4.2.12|>=4.3,<4.3.8", - "symfony/web-profiler-bundle": ">=2,<2.3.19|>=2.4,<2.4.9|>=2.5,<2.5.4", - "symfony/webhook": ">=6.3,<6.3.8", - "symfony/yaml": ">=2,<2.0.22|>=2.1,<2.1.7|>=2.2.0.0-beta1,<2.2.0.0-beta2", - "symphonycms/symphony-2": "<2.6.4", - "t3/dce": "<0.11.5|>=2.2,<2.6.2", - "t3g/svg-sanitizer": "<1.0.3", - "t3s/content-consent": "<1.0.3|>=2,<2.0.2", - "tastyigniter/tastyigniter": "<4", - "tcg/voyager": "<=1.8", - "tecnickcom/tc-lib-pdf-font": "<2.6.4", - "tecnickcom/tcpdf": "<6.8", - "terminal42/contao-tablelookupwizard": "<3.3.5", - "thelia/backoffice-default-template": ">=2.1,<2.1.2", - "thelia/thelia": ">=2.1,<2.1.3", - "theonedemon/phpwhois": "<=4.2.5", - "thinkcmf/thinkcmf": "<6.0.8", - "thorsten/phpmyfaq": "<=4.0.16|>=4.1.0.0-alpha,<=4.1.0.0-beta2", - "tikiwiki/tiki-manager": "<=17.1", - "timber/timber": ">=0.16.6,<1.23.1|>=1.24,<1.24.1|>=2,<2.1", - "tinymce/tinymce": "<7.2", - "tinymighty/wiki-seo": "<1.2.2", - "titon/framework": "<9.9.99", - "tltneon/lgsl": "<7", - "tobiasbg/tablepress": "<=2.0.0.0-RC1", - "topthink/framework": "<6.0.17|>=6.1,<=8.0.4", - "topthink/think": "<=6.1.1", - "topthink/thinkphp": "<=3.2.3|>=6.1.3,<=8.0.4", - "torrentpier/torrentpier": "<=2.8.8", - "tpwd/ke_search": "<4.0.3|>=4.1,<4.6.6|>=5,<5.0.2", - "tribalsystems/zenario": "<=9.7.61188", - "truckersmp/phpwhois": "<=4.3.1", - "ttskch/pagination-service-provider": "<1", - "twbs/bootstrap": "<3.4.1|>=4,<4.3.1", - "twig/twig": "<3.11.2|>=3.12,<3.14.1|>=3.16,<3.19", - "typo3/cms": "<9.5.29|>=10,<10.4.35|>=11,<11.5.23|>=12,<12.2", - "typo3/cms-backend": "<4.1.14|>=4.2,<4.2.15|>=4.3,<4.3.7|>=4.4,<4.4.4|>=7,<=7.6.50|>=8,<=8.7.39|>=9,<9.5.55|>=10,<=10.4.54|>=11,<=11.5.48|>=12,<=12.4.40|>=13,<=13.4.22|>=14,<=14.0.1", - "typo3/cms-belog": ">=10,<=10.4.47|>=11,<=11.5.41|>=12,<=12.4.24|>=13,<=13.4.2", - "typo3/cms-beuser": ">=9,<9.5.55|>=10,<10.4.54|>=11,<11.5.48|>=12,<12.4.37|>=13,<13.4.18", - "typo3/cms-core": "<=8.7.56|>=9,<9.5.55|>=10,<=10.4.54|>=11,<=11.5.48|>=12,<=12.4.40|>=13,<=13.4.22|>=14,<=14.0.1", - "typo3/cms-dashboard": ">=10,<10.4.54|>=11,<11.5.48|>=12,<12.4.37|>=13,<13.4.18", - "typo3/cms-extbase": "<6.2.24|>=7,<7.6.8|==8.1.1", - "typo3/cms-extensionmanager": ">=10,<=10.4.47|>=11,<=11.5.41|>=12,<=12.4.24|>=13,<=13.4.2", - "typo3/cms-felogin": ">=4.2,<4.2.3", - "typo3/cms-fluid": "<4.3.4|>=4.4,<4.4.1", - "typo3/cms-form": ">=8,<=8.7.39|>=9,<=9.5.24|>=10,<=10.4.47|>=11,<=11.5.41|>=12,<=12.4.24|>=13,<=13.4.2", - "typo3/cms-frontend": "<4.3.9|>=4.4,<4.4.5", - "typo3/cms-indexed-search": ">=10,<=10.4.47|>=11,<=11.5.41|>=12,<=12.4.24|>=13,<=13.4.2", - "typo3/cms-install": "<4.1.14|>=4.2,<4.2.16|>=4.3,<4.3.9|>=4.4,<4.4.5|>=12.2,<12.4.8|==13.4.2", - "typo3/cms-lowlevel": ">=11,<=11.5.41", - "typo3/cms-recordlist": ">=11,<11.5.48", - "typo3/cms-recycler": ">=9,<9.5.55|>=10,<=10.4.54|>=11,<=11.5.48|>=12,<=12.4.40|>=13,<=13.4.22|>=14,<=14.0.1", - "typo3/cms-redirects": ">=10,<=10.4.54|>=11,<=11.5.48|>=12,<=12.4.40|>=13,<=13.4.22|>=14,<=14.0.1", - "typo3/cms-rte-ckeditor": ">=9.5,<9.5.42|>=10,<10.4.39|>=11,<11.5.30", - "typo3/cms-scheduler": ">=11,<=11.5.41", - "typo3/cms-setup": ">=9,<=9.5.50|>=10,<=10.4.49|>=11,<=11.5.43|>=12,<=12.4.30|>=13,<=13.4.11", - "typo3/cms-webhooks": ">=12,<=12.4.30|>=13,<=13.4.11", - "typo3/cms-workspaces": ">=9,<9.5.55|>=10,<10.4.54|>=11,<11.5.48|>=12,<12.4.37|>=13,<13.4.18", - "typo3/flow": ">=1,<1.0.4|>=1.1,<1.1.1|>=2,<2.0.1|>=2.3,<2.3.16|>=3,<3.0.12|>=3.1,<3.1.10|>=3.2,<3.2.13|>=3.3,<3.3.13|>=4,<4.0.6", - "typo3/html-sanitizer": ">=1,<=1.5.2|>=2,<=2.1.3", - "typo3/neos": ">=1.1,<1.1.3|>=1.2,<1.2.13|>=2,<2.0.4|>=2.3,<2.3.99|>=3,<3.0.20|>=3.1,<3.1.18|>=3.2,<3.2.14|>=3.3,<3.3.23|>=4,<4.0.17|>=4.1,<4.1.16|>=4.2,<4.2.12|>=4.3,<4.3.3", - "typo3/phar-stream-wrapper": ">=1,<2.1.1|>=3,<3.1.1", - "typo3/swiftmailer": ">=4.1,<4.1.99|>=5.4,<5.4.5", - "typo3fluid/fluid": ">=2,<2.0.8|>=2.1,<2.1.7|>=2.2,<2.2.4|>=2.3,<2.3.7|>=2.4,<2.4.4|>=2.5,<2.5.11|>=2.6,<2.6.10", - "ua-parser/uap-php": "<3.8", - "uasoft-indonesia/badaso": "<=2.9.7", - "unisharp/laravel-filemanager": "<2.9.1", - "universal-omega/dynamic-page-list3": "<3.6.4", - "unopim/unopim": "<=0.3", - "userfrosting/userfrosting": ">=0.3.1,<4.6.3", - "usmanhalalit/pixie": "<1.0.3|>=2,<2.0.2", - "uvdesk/community-skeleton": "<=1.1.1", - "uvdesk/core-framework": "<=1.1.1", - "vanilla/safecurl": "<0.9.2", - "verbb/comments": "<1.5.5", - "verbb/formie": "<=2.1.43", - "verbb/image-resizer": "<2.0.9", - "verbb/knock-knock": "<1.2.8", - "verot/class.upload.php": "<=2.1.6", - "vertexvaar/falsftp": "<0.2.6", - "villagedefrance/opencart-overclocked": "<=1.11.1", - "vova07/yii2-fileapi-widget": "<0.1.9", - "vrana/adminer": "<=4.8.1", - "vufind/vufind": ">=2,<9.1.1", - "waldhacker/hcaptcha": "<2.1.2", - "wallabag/tcpdf": "<6.2.22", - "wallabag/wallabag": "<2.6.11", - "wanglelecc/laracms": "<=1.0.3", - "wapplersystems/a21glossary": "<=0.4.10", - "web-auth/webauthn-framework": ">=3.3,<3.3.4|>=4.5,<4.9", - "web-auth/webauthn-lib": ">=4.5,<4.9", - "web-feet/coastercms": "==5.5", - "web-tp3/wec_map": "<3.0.3", - "webbuilders-group/silverstripe-kapost-bridge": "<0.4", - "webcoast/deferred-image-processing": "<1.0.2", - "webklex/laravel-imap": "<5.3", - "webklex/php-imap": "<5.3", - "webpa/webpa": "<3.1.2", - "webreinvent/vaahcms": "<=2.3.1", - "wikibase/wikibase": "<=1.39.3", - "wikimedia/parsoid": "<0.12.2", - "willdurand/js-translation-bundle": "<2.1.1", - "winter/wn-backend-module": "<1.2.4", - "winter/wn-cms-module": "<1.0.476|>=1.1,<1.1.11|>=1.2,<1.2.7", - "winter/wn-dusk-plugin": "<2.1", - "winter/wn-system-module": "<1.2.4", - "wintercms/winter": "<=1.2.3", - "wireui/wireui": "<1.19.3|>=2,<2.1.3", - "woocommerce/woocommerce": "<6.6|>=8.8,<8.8.5|>=8.9,<8.9.3", - "wp-cli/wp-cli": ">=0.12,<2.5", - "wp-graphql/wp-graphql": "<=1.14.5", - "wp-premium/gravityforms": "<2.4.21", - "wpanel/wpanel4-cms": "<=4.3.1", - "wpcloud/wp-stateless": "<3.2", - "wpglobus/wpglobus": "<=1.9.6", - "wwbn/avideo": "<14.3", - "xataface/xataface": "<3", - "xpressengine/xpressengine": "<3.0.15", - "yab/quarx": "<2.4.5", - "yeswiki/yeswiki": "<=4.5.4", - "yetiforce/yetiforce-crm": "<6.5", - "yidashi/yii2cmf": "<=2", - "yii2mod/yii2-cms": "<1.9.2", - "yiisoft/yii": "<1.1.31", - "yiisoft/yii2": "<2.0.52", - "yiisoft/yii2-authclient": "<2.2.15", - "yiisoft/yii2-bootstrap": "<2.0.4", - "yiisoft/yii2-dev": "<=2.0.45", - "yiisoft/yii2-elasticsearch": "<2.0.5", - "yiisoft/yii2-gii": "<=2.2.4", - "yiisoft/yii2-jui": "<2.0.4", - "yiisoft/yii2-redis": "<2.0.20", - "yikesinc/yikes-inc-easy-mailchimp-extender": "<6.8.6", - "yoast-seo-for-typo3/yoast_seo": "<7.2.3", - "yourls/yourls": "<=1.10.2", - "yuan1994/tpadmin": "<=1.3.12", - "yungifez/skuul": "<=2.6.5", - "z-push/z-push-dev": "<2.7.6", - "zencart/zencart": "<=1.5.7.0-beta", - "zendesk/zendesk_api_client_php": "<2.2.11", - "zendframework/zend-cache": ">=2.4,<2.4.8|>=2.5,<2.5.3", - "zendframework/zend-captcha": ">=2,<2.4.9|>=2.5,<2.5.2", - "zendframework/zend-crypt": ">=2,<2.4.9|>=2.5,<2.5.2", - "zendframework/zend-db": "<2.2.10|>=2.3,<2.3.5", - "zendframework/zend-developer-tools": ">=1.2.2,<1.2.3", - "zendframework/zend-diactoros": "<1.8.4", - "zendframework/zend-feed": "<2.10.3", - "zendframework/zend-form": ">=2,<2.2.7|>=2.3,<2.3.1", - "zendframework/zend-http": "<2.8.1", - "zendframework/zend-json": ">=2.1,<2.1.6|>=2.2,<2.2.6", - "zendframework/zend-ldap": ">=2,<2.0.99|>=2.1,<2.1.99|>=2.2,<2.2.8|>=2.3,<2.3.3", - "zendframework/zend-mail": "<2.4.11|>=2.5,<2.7.2", - "zendframework/zend-navigation": ">=2,<2.2.7|>=2.3,<2.3.1", - "zendframework/zend-session": ">=2,<2.2.9|>=2.3,<2.3.4", - "zendframework/zend-validator": ">=2.3,<2.3.6", - "zendframework/zend-view": ">=2,<2.2.7|>=2.3,<2.3.1", - "zendframework/zend-xmlrpc": ">=2.1,<2.1.6|>=2.2,<2.2.6", - "zendframework/zendframework": "<=3", - "zendframework/zendframework1": "<1.12.20", - "zendframework/zendopenid": "<2.0.2", - "zendframework/zendrest": "<2.0.2", - "zendframework/zendservice-amazon": "<2.0.3", - "zendframework/zendservice-api": "<1", - "zendframework/zendservice-audioscrobbler": "<2.0.2", - "zendframework/zendservice-nirvanix": "<2.0.2", - "zendframework/zendservice-slideshare": "<2.0.2", - "zendframework/zendservice-technorati": "<2.0.2", - "zendframework/zendservice-windowsazure": "<2.0.2", - "zendframework/zendxml": ">=1,<1.0.1", - "zenstruck/collection": "<0.2.1", - "zetacomponents/mail": "<1.8.2", - "zf-commons/zfc-user": "<1.2.2", - "zfcampus/zf-apigility-doctrine": ">=1,<1.0.3", - "zfr/zfr-oauth2-server-module": "<0.1.2", - "zoujingli/thinkadmin": "<=6.1.53" - }, - "default-branch": true, - "type": "metapackage", - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com", - "role": "maintainer" - }, - { - "name": "Ilya Tribusean", - "email": "slash3b@gmail.com", - "role": "maintainer" - } - ], - "description": "Prevents installation of composer packages with known security vulnerabilities: no API, simply require it", - "keywords": [ - "dev" - ], - "support": { - "issues": "https://github.com/Roave/SecurityAdvisories/issues", - "source": "https://github.com/Roave/SecurityAdvisories/tree/latest" - }, - "funding": [ - { - "url": "https://github.com/Ocramius", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/roave/security-advisories", - "type": "tidelift" - } - ], - "time": "2026-01-30T22:06:58+00:00" - }, { "name": "sebastian/cli-parser", "version": "1.0.2", @@ -7541,13 +6615,12 @@ "aliases": [], "minimum-stability": "stable", "stability-flags": { - "rhukster/dom-sanitizer": 20, - "roave/security-advisories": 20 + "rhukster/dom-sanitizer": 20 }, "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": ">=7.4", + "php": ">=8.2", "ext-apcu": "*", "ext-ctype": "*", "ext-curl": "*", @@ -7568,7 +6641,7 @@ }, "platform-dev": [], "platform-overrides": { - "php": "7.4" + "php": "8.2" }, "plugin-api-version": "2.6.0" } diff --git a/composer.phar b/composer.phar new file mode 100755 index 000000000000..553efcce527c Binary files /dev/null and b/composer.phar differ diff --git a/config/config.sample.php b/config/config.sample.php index a4b9fb06ccea..80186e339a07 100644 --- a/config/config.sample.php +++ b/config/config.sample.php @@ -445,7 +445,7 @@ /** * Define the SMTP security style - * Depends on `mail_smtpmode`. Specify when you are using `ssl` or `tls`. + * Depends on `mail_smtpmode`. Specify when you are using `ssl` or not. * Leave empty for no encryption. */ 'mail_smtpsecure' => '', @@ -456,13 +456,6 @@ */ 'mail_smtpauth' => false, -/** - * Define the SMTP authentication type - * Depends on `mail_smtpmode`. If SMTP authentication is required, - * choose the authentication type as `LOGIN` (default) or `PLAIN`. - */ -'mail_smtpauthtype' => 'LOGIN', - /** * Define the SMTP authentication username * Depends on `mail_smtpauth`. Specify the username for authenticating to the SMTP server. diff --git a/core/Command/Integrity/SignApp.php b/core/Command/Integrity/SignApp.php index a68c47cf649c..b9bd469df82c 100644 --- a/core/Command/Integrity/SignApp.php +++ b/core/Command/Integrity/SignApp.php @@ -26,6 +26,7 @@ use OC\IntegrityCheck\Helpers\FileAccessHelper; use OCP\IURLGenerator; use phpseclib3\Crypt\RSA; +use phpseclib3\Crypt\RSA\PrivateKey; use phpseclib3\File\X509; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; diff --git a/core/Command/Integrity/SignCore.php b/core/Command/Integrity/SignCore.php index a998adfcc29b..116785160a2f 100644 --- a/core/Command/Integrity/SignCore.php +++ b/core/Command/Integrity/SignCore.php @@ -25,6 +25,7 @@ use OC\IntegrityCheck\Checker; use OC\IntegrityCheck\Helpers\FileAccessHelper; use phpseclib3\Crypt\RSA; +use phpseclib3\Crypt\RSA\PrivateKey; use phpseclib3\File\X509; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; diff --git a/core/Command/User/ListUsers.php b/core/Command/User/ListUsers.php index ac1277f74623..7412271cfdc9 100644 --- a/core/Command/User/ListUsers.php +++ b/core/Command/User/ListUsers.php @@ -99,7 +99,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int $showAllAttributes = $input->getOption('show-all-attributes'); $useKey = \count($attributes) > 1 || $input->getOption('output') !== self::OUTPUT_FORMAT_PLAIN; - $users = $this->userManager->search($userNameSubString, null, null, true); + $users = $this->userManager->search($userNameSubString ?? '', null, null, true); $users = \array_map(function (IUser $user) use ($output, $attributes, $useKey, $showAllAttributes) { if ($output->isVerbose() || $showAllAttributes) { // include all attributes diff --git a/core/Controller/AvatarController.php b/core/Controller/AvatarController.php index 0c70e5992e77..cd72a19f27ad 100644 --- a/core/Controller/AvatarController.php +++ b/core/Controller/AvatarController.php @@ -213,7 +213,7 @@ public function postAvatar($path) { try { $image = new \OC_Image(); - $image->load($handle); + $image->loadFromFileHandle($handle); $image->fixOrientation(); // don't accept images with too big dimensions // 4k - 4096×2160 diff --git a/core/Controller/LostController.php b/core/Controller/LostController.php index 3155711e6749..ccbe084d87e4 100644 --- a/core/Controller/LostController.php +++ b/core/Controller/LostController.php @@ -166,7 +166,7 @@ public function resetform($token, $userId) { private function checkPasswordResetToken($token, $userId) { $user = $this->userManager->get($userId); - $splittedToken = \explode(':', $this->config->getUserValue($userId, 'owncloud', 'lostpassword', null)); + $splittedToken = \explode(':', $this->config->getUserValue($userId, 'owncloud', 'lostpassword', null) ?? ''); if (\count($splittedToken) !== 2) { $this->config->deleteUserValue($userId, 'owncloud', 'lostpassword'); throw new \Exception($this->l10n->t('Could not reset password because the token is invalid')); @@ -354,7 +354,7 @@ public function sendEmail($user, $token, $link) { } } - $getToken = $this->config->getUserValue($user, 'owncloud', 'lostpassword'); + $getToken = $this->config->getUserValue($user, 'owncloud', 'lostpassword') ?? ''; if ($getToken !== '') { $splittedToken = \explode(':', $getToken); if ((\count($splittedToken)) === 2 && $splittedToken[0] > ($this->timeFactory->getTime() - 60 * 5)) { @@ -383,7 +383,7 @@ public function sendEmail($user, $token, $link) { $this->mailer->send($message); } catch (\Exception $e) { throw new \Exception($this->l10n->t( - 'Couldn\'t send reset email. Please contact your administrator.' + "Couldn't send reset email. Please contact your administrator." )); } diff --git a/lib/base.php b/lib/base.php index 43269235bf7f..0705862347aa 100644 --- a/lib/base.php +++ b/lib/base.php @@ -5,14 +5,14 @@ if (\defined('OC_CONSOLE')) { $eol = PHP_EOL; } -if (PHP_VERSION_ID < 70400) { - echo 'This version of ownCloud requires at least PHP 7.4.0'.$eol; +if (PHP_VERSION_ID < 80300) { + echo 'This version of ownCloud requires at least PHP 8.3.0'.$eol; echo 'You are currently running PHP ' . PHP_VERSION . '. Please update your PHP version.'.$eol; exit(1); } -if (PHP_VERSION_ID >= 80000) { - echo 'This version of ownCloud is not compatible with PHP 8.0' . $eol; +if (PHP_VERSION_ID >= 80600) { + echo 'This version of ownCloud is not compatible with PHP 8.6' . $eol; echo 'You are currently running PHP ' . PHP_VERSION . '.' . $eol; exit(1); } diff --git a/lib/private/App/DependencyAnalyzer.php b/lib/private/App/DependencyAnalyzer.php index 4acbc9b181dc..15d47f928fb0 100644 --- a/lib/private/App/DependencyAnalyzer.php +++ b/lib/private/App/DependencyAnalyzer.php @@ -136,19 +136,19 @@ private function analyzePhpVersion(array $dependencies) { if (isset($dependencies['php']['@attributes']['min-version'])) { $minVersion = $dependencies['php']['@attributes']['min-version']; if ($this->compareSmaller($this->platform->getPhpVersion(), $minVersion)) { - $missing[] = (string)$this->l->t('PHP %s or higher is required.', $minVersion); + $missing[] = (string)$this->l->t('PHP %s or higher is required.', [$minVersion]); } } if (isset($dependencies['php']['@attributes']['max-version'])) { $maxVersion = $dependencies['php']['@attributes']['max-version']; if ($this->compareBigger($this->platform->getPhpVersion(), $maxVersion)) { - $missing[] = (string)$this->l->t('PHP with a version lower than %s is required.', $maxVersion); + $missing[] = (string)$this->l->t('PHP with a version lower than %s is required.', [$maxVersion]); } } if (isset($dependencies['php']['@attributes']['min-int-size'])) { $intSize = $dependencies['php']['@attributes']['min-int-size']; if ($intSize > $this->platform->getIntSize()*8) { - $missing[] = (string)$this->l->t('%sbit or higher PHP required.', $intSize); + $missing[] = (string)$this->l->t('%sbit or higher PHP required.', [$intSize]); } } return $missing; @@ -175,8 +175,8 @@ private function analyzeDatabases(array $dependencies) { return $this->getValue($db); }, $supportedDatabases); $currentDatabase = $this->platform->getDatabase(); - if (!\in_array($currentDatabase, $supportedDatabases)) { - $missing[] = (string)$this->l->t('Following databases are supported: %s', \join(', ', $supportedDatabases)); + if (!\in_array($currentDatabase, $supportedDatabases, true)) { + $missing[] = (string)$this->l->t('Following databases are supported: %s', [\implode(', ', $supportedDatabases)]); } return $missing; } @@ -205,7 +205,7 @@ private function analyzeCommands(array $dependencies) { } $commandName = $this->getValue($command); if (!$this->platform->isCommandKnown($commandName)) { - $missing[] = (string)$this->l->t('The command line tool %s could not be found', $commandName); + $missing[] = (string)$this->l->t('The command line tool %s could not be found', [$commandName]); } } return $missing; @@ -232,7 +232,7 @@ private function analyzeLibraries(array $dependencies) { $libName = $this->getValue($lib); $libVersion = $this->platform->getLibraryVersion($libName); if ($libVersion === null) { - $missing[] = (string)$this->l->t('The library %s is not available.', $libName); + $missing[] = (string)$this->l->t('The library %s is not available.', [$libName]); continue; } @@ -282,8 +282,8 @@ private function analyzeOS(array $dependencies) { $oss = [$oss]; } $currentOS = $this->platform->getOS(); - if (!\in_array($currentOS, $oss)) { - $missing[] = (string)$this->l->t('Following platforms are supported: %s', \join(', ', $oss)); + if (!\in_array($currentOS, $oss, true)) { + $missing[] = (string)$this->l->t('Following platforms are supported: %s', [\implode(', ', $oss)]); } return $missing; } @@ -312,12 +312,12 @@ private function analyzeOC(array $dependencies, array $appInfo) { if ($minVersion !== null) { if ($this->compareSmaller($this->platform->getOcVersion(), $minVersion)) { - $missing[] = (string)$this->l->t('ownCloud %s or higher is required.', $minVersion); + $missing[] = (string)$this->l->t('ownCloud %s or higher is required.', [$minVersion]); } } if ($maxVersion !== null) { if ($this->compareBigger($this->platform->getOcVersion(), $maxVersion)) { - $missing[] = (string)$this->l->t('ownCloud %s or lower is required.', $maxVersion); + $missing[] = (string)$this->l->t('ownCloud %s or lower is required.', [$maxVersion]); } } return $missing; diff --git a/lib/private/App/InfoParser.php b/lib/private/App/InfoParser.php index 6ca1ecc2ca7f..93f5ead4fd8e 100644 --- a/lib/private/App/InfoParser.php +++ b/lib/private/App/InfoParser.php @@ -43,10 +43,8 @@ public function parse($file) { } \libxml_use_internal_errors(true); - $loadEntities = \libxml_disable_entity_loader(false); $xml = \simplexml_load_file($file); - \libxml_disable_entity_loader($loadEntities); if ($xml === false) { \libxml_clear_errors(); throw new InvalidArgumentException('Invalid XML'); diff --git a/lib/private/AppFramework/Db/Db.php b/lib/private/AppFramework/Db/Db.php index 296e0c3e1ccd..5ba050722443 100644 --- a/lib/private/AppFramework/Db/Db.php +++ b/lib/private/AppFramework/Db/Db.php @@ -234,7 +234,7 @@ public function tableExists($table) { /** * @inheritdoc */ - public function escapeLikeParameter($param) { + public function escapeLikeParameter(string $param): string { return $this->connection->escapeLikeParameter($param); } diff --git a/lib/private/AppFramework/Http.php b/lib/private/AppFramework/Http.php index b8ef72c83a45..17a89cfd17e4 100644 --- a/lib/private/AppFramework/Http.php +++ b/lib/private/AppFramework/Http.php @@ -30,15 +30,15 @@ use OCP\AppFramework\Http as BaseHttp; class Http extends BaseHttp { - private $server; - private $protocolVersion; - protected $headers; + private array $server; + private string $protocolVersion; + protected array $headers; /** * @param array $server $_SERVER * @param string $protocolVersion the http version to use defaults to HTTP/1.1 */ - public function __construct($server, $protocolVersion='HTTP/1.1') { + public function __construct(array $server, string $protocolVersion='HTTP/1.1') { $this->server = $server; $this->protocolVersion = $protocolVersion; @@ -107,16 +107,17 @@ public function __construct($server, $protocolVersion='HTTP/1.1') { /** * Gets the correct header + * * @param Http::CONSTANT $status the constant from the Http class - * @param \DateTime $lastModified formatted last modified date - * @param string $ETag the etag + * @param \DateTime|null $lastModified formatted last modified date + * @param null $ETag the etag * @return string */ public function getStatusHeader( $status, \DateTime $lastModified=null, $ETag=null - ) { + ): string { if ($lastModified !== null) { $lastModified = $lastModified->format(\DateTime::RFC2822); } @@ -135,7 +136,7 @@ public function getStatusHeader( // we have one change currently for the http 1.0 header that differs // from 1.1: STATUS_TEMPORARY_REDIRECT should be STATUS_FOUND - // if this differs any more, we want to create childclasses for this + // if this differs anymore, we want to create child-classes for this if ($status === self::STATUS_TEMPORARY_REDIRECT && $this->protocolVersion === 'HTTP/1.0') { $status = self::STATUS_FOUND; diff --git a/lib/private/AppFramework/Http/Dispatcher.php b/lib/private/AppFramework/Http/Dispatcher.php index 98666bc2dc7b..ae92ea6942f1 100644 --- a/lib/private/AppFramework/Http/Dispatcher.php +++ b/lib/private/AppFramework/Http/Dispatcher.php @@ -26,23 +26,28 @@ namespace OC\AppFramework\Http; -use \OC\AppFramework\Middleware\MiddlewareDispatcher; -use \OC\AppFramework\Http; -use \OC\AppFramework\Utility\ControllerMethodReflector; +use Exception; +use OC\AppFramework\Middleware\MiddlewareDispatcher; +use OC\AppFramework\Http; +use OC\AppFramework\Utility\ControllerMethodReflector; use OCP\AppFramework\Controller; use OCP\AppFramework\Http\Response; use OCP\AppFramework\Http\DataResponse; use OCP\IRequest; +use function array_merge; +use function call_user_func_array; +use function in_array; +use function settype; /** * Class to dispatch the request to the middleware dispatcher */ class Dispatcher { - private $middlewareDispatcher; - private $protocol; - private $reflector; - private $request; + private MiddlewareDispatcher $middlewareDispatcher; + private Http $protocol; + private ControllerMethodReflector $reflector; + private IRequest $request; /** * @param Http $protocol the http protocol with contains all status headers @@ -66,19 +71,20 @@ public function __construct( /** * Handles a request and calls the dispatcher on the controller + * * @param Controller $controller the controller which will be called * @param string $methodName the method name which will be called on * the controller * @return array $array[0] contains a string with the http main header, * $array[1] contains headers in the form: $key => value, $array[2] contains * the response output - * @throws \Exception + * @throws Exception */ - public function dispatch(Controller $controller, $methodName) { + public function dispatch(Controller $controller, string $methodName): array { $out = [null, [], null]; try { - // prefill reflector with everything thats needed for the + // prefill reflector with everything that's needed for the // middlewares $this->reflector->reflect($controller, $methodName); @@ -90,9 +96,9 @@ public function dispatch(Controller $controller, $methodName) { // if an exception appears, the middleware checks if it can handle the // exception and creates a response. If no response is created, it is - // assumed that theres no middleware who can handle it and the error is + // assumed that there's no middleware who can handle it and the error is // thrown again - } catch (\Exception $exception) { + } catch (Exception $exception) { $response = $this->middlewareDispatcher->afterException( $controller, $methodName, @@ -115,7 +121,7 @@ public function dispatch(Controller $controller, $methodName) { $response->getLastModified(), $response->getETag() ); - $out[1] = \array_merge($response->getHeaders()); + $out[1] = array_merge($response->getHeaders()); $out[2] = $response->getCookies(); $out[3] = $this->middlewareDispatcher->beforeOutput( $controller, @@ -130,11 +136,12 @@ public function dispatch(Controller $controller, $methodName) { /** * Uses the reflected parameters, types and request parameters to execute * the controller + * * @param Controller $controller the controller to be executed * @param string $methodName the method on the controller that should be executed * @return Response */ - private function executeController($controller, $methodName) { + private function executeController(Controller $controller, string $methodName): Response { $arguments = []; // valid types that will be casted @@ -152,15 +159,12 @@ private function executeController($controller, $methodName) { $value === 'false' && ( $this->request->method === 'GET' || - \strpos( - $this->request->getHeader('Content-Type') ?? '', - 'application/x-www-form-urlencoded' - ) !== false + str_contains($this->request->getHeader('Content-Type') ?? '', 'application/x-www-form-urlencoded') ) ) { $value = false; - } elseif ($value !== null && \in_array($type, $types)) { - \settype($value, $type); + } elseif ($value !== null && \in_array($type, $types, true)) { + settype($value, $type); } $arguments[] = $value; diff --git a/lib/private/AppFramework/Http/Request.php b/lib/private/AppFramework/Http/Request.php index e9e0e6cabdba..2f6bf6993b66 100644 --- a/lib/private/AppFramework/Http/Request.php +++ b/lib/private/AppFramework/Http/Request.php @@ -168,7 +168,7 @@ public function setUrlParameters(array $parameters): void { * Countable method * @return int */ - public function count() { + public function count(): int { return \count(\array_keys($this->items['parameters'])); } @@ -192,28 +192,28 @@ public function count() { * @param string $offset The key to lookup * @return boolean */ - public function offsetExists($offset) { + public function offsetExists($offset): bool { return isset($this->items['parameters'][$offset]); } /** * @see offsetExists */ - public function offsetGet($offset) { + public function offsetGet($offset): mixed { return $this->items['parameters'][$offset] ?? null; } /** * @see offsetExists */ - public function offsetSet($offset, $value) { + public function offsetSet($offset, $value): void { throw new \RuntimeException('You cannot change the contents of the request object'); } /** * @see offsetExists */ - public function offsetUnset($offset) { + public function offsetUnset($offset): void { throw new \RuntimeException('You cannot change the contents of the request object'); } @@ -324,10 +324,10 @@ public function getHeader(string $name): ?string { * 1. URL parameters * 2. POST parameters * 3. GET parameters - * @param mixed $default If the key is not found, this value will be returned + * @param mixed|null $default If the key is not found, this value will be returned * @return mixed the content of the array */ - public function getParam($key, $default = null) { + public function getParam(string $key, mixed $default = null): mixed { return $this->parameters[$key] ?? $default; } @@ -336,7 +336,7 @@ public function getParam($key, $default = null) { * (as GET or POST) or through the URL by the route * @return array the array with all parameters */ - public function getParams() { + public function getParams(): array { return $this->parameters; } @@ -344,7 +344,7 @@ public function getParams() { * Returns the method of the request * @return string the method of the request (POST, GET, etc) */ - public function getMethod() { + public function getMethod(): string { return $this->method; } @@ -391,8 +391,8 @@ protected function getContent() { if ($this->method === 'PUT' && $this->getHeader('Content-Length') !== 0 && $this->getHeader('Content-Length') !== null - && \strpos($this->getHeader('Content-Type') ?? '', 'application/x-www-form-urlencoded') === false - && \strpos($this->getHeader('Content-Type') ?? '', 'application/json') === false + && !str_contains($this->getHeader('Content-Type') ?? '', 'application/x-www-form-urlencoded') + && !str_contains($this->getHeader('Content-Type') ?? '', 'application/json') ) { if ($this->content === false) { throw new \LogicException( @@ -431,7 +431,7 @@ protected function decodeContent() { // or post correctly } elseif ($this->method !== 'GET' && $this->method !== 'POST' - && \strpos($this->getHeader('Content-Type') ?? '', 'application/x-www-form-urlencoded') !== false) { + && str_contains($this->getHeader('Content-Type') ?? '', 'application/x-www-form-urlencoded')) { \parse_str(\file_get_contents($this->inputStream), $params); if (\is_array($params)) { $this->items['params'] = $params; @@ -586,8 +586,8 @@ public function getServerProtocol() { * * @return string HTTP protocol. HTTP/2, HTTP/1.1 or HTTP/1.0. */ - public function getHttpProtocol() { - $claimedProtocol = \strtoupper($this->server['SERVER_PROTOCOL']); + public function getHttpProtocol(): string { + $claimedProtocol = \strtoupper($this->server['SERVER_PROTOCOL'] ?? 'HTTP/1.1'); $validProtocols = [ 'HTTP/1.0', @@ -658,18 +658,18 @@ public function getRawPathInfo() { // strip off the script name's dir and file name // FIXME: Sabre does not really belong here - list($path, $name) = \Sabre\Uri\split($scriptName); + [$path, $name] = \Sabre\Uri\split($scriptName); if (!empty($path)) { - if ($path === $pathInfo || \strpos($pathInfo, $path.'/') === 0) { + if ($path === $pathInfo || str_starts_with($pathInfo, $path . '/')) { $pathInfo = \substr($pathInfo, \strlen($path)); } else { throw new \Exception("The requested uri($requestUri) cannot be processed by the script '$scriptName')"); } } - if (\strpos($pathInfo, "/$name") === 0) { - $pathInfo = \substr($pathInfo, \strlen($name) + 1); + if (str_starts_with($pathInfo, "/$name")) { + $pathInfo = \substr($pathInfo, \strlen($name ?? '') + 1); } - if (\is_string($name) && \strpos($pathInfo, $name) === 0) { + if (\is_string($name) && str_starts_with($pathInfo, $name)) { $pathInfo = \substr($pathInfo, \strlen($name)); } @@ -709,7 +709,7 @@ public function getPathInfo() { */ public function getScriptName() { $name = $this->server['SCRIPT_NAME']; - $overwriteWebRoot = $this->config->getSystemValue('overwritewebroot'); + $overwriteWebRoot = $this->config->getSystemValue('overwritewebroot') ?? ''; if ($overwriteWebRoot !== '' && $this->isOverwriteCondition()) { // FIXME: This code is untestable due to __DIR__, also that hardcoded path is really dangerous $serverRoot = \str_replace('\\', '/', \substr(__DIR__, 0, -\strlen('lib/private/appframework/http/'))); diff --git a/lib/private/AppFramework/Utility/SimpleContainer.php b/lib/private/AppFramework/Utility/SimpleContainer.php index 91d7b1a15484..1d8d820a22c8 100644 --- a/lib/private/AppFramework/Utility/SimpleContainer.php +++ b/lib/private/AppFramework/Utility/SimpleContainer.php @@ -47,31 +47,30 @@ private function buildClass(ReflectionClass $class) { $constructor = $class->getConstructor(); if ($constructor === null) { return $class->newInstance(); - } else { - $parameters = []; - foreach ($constructor->getParameters() as $parameter) { - $parameterClass = $parameter->getClass(); + } - // try to find out if it is a class or a simple parameter - if ($parameterClass === null) { - $resolveName = $parameter->getName(); - } else { - $resolveName = $parameterClass->name; - } + $parameters = []; + foreach ($constructor->getParameters() as $parameter) { + $resolveName = $parameter->getName(); - try { - $parameters[] = $this->query($resolveName); - } catch (QueryException $ex) { - if ($parameter->isDefaultValueAvailable()) { - $default = $parameter->getDefaultValue(); - $parameters[] = $default; - } else { - throw $ex; - } + $parameterType = $parameter->getType(); + // try to find out if it is a class or a simple parameter + if (($parameterType instanceof \ReflectionNamedType) && !$parameterType->isBuiltin()) { + $resolveName = $parameterType->getName(); + } + + try { + $parameters[] = $this->query($resolveName); + } catch (QueryException $ex) { + if ($parameter->isDefaultValueAvailable()) { + $default = $parameter->getDefaultValue(); + $parameters[] = $default; + } else { + throw $ex; } } - return $class->newInstanceArgs($parameters); } + return $class->newInstanceArgs($parameters); } /** diff --git a/lib/private/Archive/ZIP.php b/lib/private/Archive/ZIP.php index 897d6f671221..ba7f6eda226f 100644 --- a/lib/private/Archive/ZIP.php +++ b/lib/private/Archive/ZIP.php @@ -30,9 +30,11 @@ namespace OC\Archive; +use ZipArchive; + class ZIP extends Archive { /** - * @var \ZipArchive zip + * @var ZipArchive zip */ private $zip=null; private $path; @@ -42,8 +44,8 @@ class ZIP extends Archive { */ public function __construct($source) { $this->path=$source; - $this->zip=new \ZipArchive(); - if ($this->zip->open($source, \ZipArchive::CREATE)) { + $this->zip=new ZipArchive(); + if ($this->zip->open($source, ZipArchive::CREATE)) { } else { \OCP\Util::writeLog('files_archive', 'Error while opening archive '.$source, \OCP\Util::WARN); } diff --git a/lib/private/Authentication/Token/DefaultToken.php b/lib/private/Authentication/Token/DefaultToken.php index 64a7d676f7b0..43f1a33ab22b 100644 --- a/lib/private/Authentication/Token/DefaultToken.php +++ b/lib/private/Authentication/Token/DefaultToken.php @@ -102,7 +102,7 @@ public function getPassword() { return $this->password; } - public function jsonSerialize() { + public function jsonSerialize(): array { return [ 'id' => $this->id, 'name' => $this->name, diff --git a/lib/private/Avatar.php b/lib/private/Avatar.php index 293499b3464c..653eac875608 100644 --- a/lib/private/Avatar.php +++ b/lib/private/Avatar.php @@ -72,7 +72,7 @@ public function __construct(IStorage $storage, IL10N $l, User $user, ILogger $lo $this->path = $this->buildAvatarPath(); } - private function buildAvatarPath() { + private function buildAvatarPath(): string { return 'avatars/' . \substr_replace(\substr_replace(\md5($this->user->getUID()), '/', 4, 0), '/', 2, 0); } diff --git a/lib/private/BackgroundJob/JobList.php b/lib/private/BackgroundJob/JobList.php index bd0d265c1d04..e37b1db0ba70 100644 --- a/lib/private/BackgroundJob/JobList.php +++ b/lib/private/BackgroundJob/JobList.php @@ -209,7 +209,7 @@ public function getNext() { } // skip jobs marked as disabled - $jobs_disabled = \explode(',', $this->config->getAppValue('backgroundjob', 'jobs_disabled', '')); + $jobs_disabled = \explode(',', $this->config->getAppValue('backgroundjob', 'jobs_disabled', '') ?? ''); if (\in_array($row['id'], $jobs_disabled, true)) { $this->logger->warning("Background job configuration has the job {$row['id']} as disabled. Skipping it"); return $this->getNext(); diff --git a/lib/private/Cache/CappedMemoryCache.php b/lib/private/Cache/CappedMemoryCache.php index 1e0b9eddef3c..38322c66bf06 100644 --- a/lib/private/Cache/CappedMemoryCache.php +++ b/lib/private/Cache/CappedMemoryCache.php @@ -60,19 +60,19 @@ public function clear($prefix = '') { return true; } - public function offsetExists($offset) { + public function offsetExists($offset): bool { return $this->hasKey($offset); } - public function &offsetGet($offset) { + public function &offsetGet($offset): mixed { return $this->cache[$offset]; } - public function offsetSet($offset, $value) { + public function offsetSet($offset, $value): void { $this->set($offset, $value); } - public function offsetUnset($offset) { + public function offsetUnset($offset): void { $this->remove($offset); } diff --git a/lib/private/DB/Connection.php b/lib/private/DB/Connection.php index 3d2c74666473..c1a64f1a91ca 100644 --- a/lib/private/DB/Connection.php +++ b/lib/private/DB/Connection.php @@ -440,7 +440,7 @@ public function inTransaction() { * @param string $param * @return string */ - public function escapeLikeParameter($param) { + public function escapeLikeParameter(string $param): string { return \addcslashes($param, '\\_%'); } diff --git a/lib/private/DB/MDB2SchemaManager.php b/lib/private/DB/MDB2SchemaManager.php index 5213209834a9..3f02101d1700 100644 --- a/lib/private/DB/MDB2SchemaManager.php +++ b/lib/private/DB/MDB2SchemaManager.php @@ -136,11 +136,15 @@ public function removeDBStructure($file) { * @return bool */ private function executeSchemaChange($schema) { - $this->conn->beginTransaction(); + if (!$this->conn->getDatabasePlatform() instanceof MySQLPlatform) { + $this->conn->beginTransaction(); + } foreach ($schema->toSql($this->conn->getDatabasePlatform()) as $sql) { - $this->conn->query($sql); + $this->conn->executeQuery($sql); + } + if (!$this->conn->getDatabasePlatform() instanceof MySQLPlatform) { + $this->conn->commit(); } - $this->conn->commit(); if ($this->conn->getDatabasePlatform() instanceof SqlitePlatform) { $this->conn->close(); diff --git a/lib/private/DB/MDB2SchemaReader.php b/lib/private/DB/MDB2SchemaReader.php index cf6be41ce7b0..e917cf0c9cab 100644 --- a/lib/private/DB/MDB2SchemaReader.php +++ b/lib/private/DB/MDB2SchemaReader.php @@ -54,9 +54,7 @@ public function __construct(IConfig $config, AbstractPlatform $platform) { * @return Schema */ public function loadSchemaFromFile($file, Schema $schema) { - $loadEntities = \libxml_disable_entity_loader(false); $xml = \simplexml_load_file($file); - \libxml_disable_entity_loader($loadEntities); foreach ($xml->children() as $child) { /** * @var \SimpleXMLElement $child diff --git a/lib/private/DB/Migrator.php b/lib/private/DB/Migrator.php index 94bc3c8a9a2b..fbf0ecaf4da9 100644 --- a/lib/private/DB/Migrator.php +++ b/lib/private/DB/Migrator.php @@ -28,8 +28,7 @@ namespace OC\DB; use Doctrine\DBAL\Schema\AbstractAsset; -use \Doctrine\DBAL\Schema\Index; -use \Doctrine\DBAL\Schema\Table; +use Doctrine\DBAL\Platforms\MySQLPlatform; use \Doctrine\DBAL\Schema\Schema; use \Doctrine\DBAL\Schema\Comparator; use Doctrine\DBAL\Types\StringType; @@ -175,14 +174,18 @@ protected function applySchema(Schema $targetSchema, \Doctrine\DBAL\Connection $ $schemaDiff = $this->getDiff($targetSchema, $connection); - $connection->beginTransaction(); + if (!$connection->getDatabasePlatform() instanceof MySQLPlatform) { + $connection->beginTransaction(); + } $sqls = $schemaDiff->toSql($connection->getDatabasePlatform()); $step = 0; foreach ($sqls as $sql) { $this->emit($sql, $step++, \count($sqls)); - $connection->query($sql); + $connection->executeQuery($sql); + } + if (!$connection->getDatabasePlatform() instanceof MySQLPlatform) { + $connection->commit(); } - $connection->commit(); } /** diff --git a/lib/private/DB/QueryBuilder/CompositeExpression.php b/lib/private/DB/QueryBuilder/CompositeExpression.php index 22af55359f52..ff0b372947e8 100644 --- a/lib/private/DB/QueryBuilder/CompositeExpression.php +++ b/lib/private/DB/QueryBuilder/CompositeExpression.php @@ -68,7 +68,7 @@ public function add($part) { * * @return integer */ - public function count() { + public function count(): int { return $this->compositeExpression->count(); } diff --git a/lib/private/Diagnostics/Query.php b/lib/private/Diagnostics/Query.php index 7c6d2ce6a1ed..7b7b57d8f454 100644 --- a/lib/private/Diagnostics/Query.php +++ b/lib/private/Diagnostics/Query.php @@ -76,7 +76,7 @@ public function getDuration() { return $this->end - $this->start; } - public function jsonSerialize() { + public function jsonSerialize(): mixed { return [ 'query' => $this->sql, 'parameters' => $this->params, diff --git a/lib/private/Diagnostics/QueryLogger.php b/lib/private/Diagnostics/QueryLogger.php index 1d2254222e6d..decb3edc6023 100644 --- a/lib/private/Diagnostics/QueryLogger.php +++ b/lib/private/Diagnostics/QueryLogger.php @@ -82,10 +82,10 @@ public function flush(): void { $this->queries = []; } - private function getMicrotime(): float { + private function getMicrotime(): int { if ($this->testNow) { - return $this->testNow; + return (int)$this->testNow; } - return microtime(true); + return (int)microtime(true); } } diff --git a/lib/private/Files/Cache/CacheEntry.php b/lib/private/Files/Cache/CacheEntry.php index f5e647848d03..871492e1eb26 100644 --- a/lib/private/Files/Cache/CacheEntry.php +++ b/lib/private/Files/Cache/CacheEntry.php @@ -36,24 +36,20 @@ public function __construct(array $data) { $this->data = $data; } - public function offsetSet($offset, $value) { + public function offsetSet($offset, $value): void { $this->data[$offset] = $value; } - public function offsetExists($offset) { + public function offsetExists($offset): bool { return isset($this->data[$offset]); } - public function offsetUnset($offset) { + public function offsetUnset($offset): void { unset($this->data[$offset]); } - public function offsetGet($offset) { - if (isset($this->data[$offset])) { - return $this->data[$offset]; - } else { - return null; - } + public function offsetGet($offset): mixed { + return $this->data[$offset] ?? null; } public function getId() { diff --git a/lib/private/Files/Cache/Wrapper/CacheJail.php b/lib/private/Files/Cache/Wrapper/CacheJail.php index c425e9767a6a..10eef736c02b 100644 --- a/lib/private/Files/Cache/Wrapper/CacheJail.php +++ b/lib/private/Files/Cache/Wrapper/CacheJail.php @@ -61,7 +61,7 @@ protected function getSourcePath($path) { * @param string $path * @return null|string the jailed path or null if the path is outside the jail */ - protected function getJailedPath($path) { + protected function getJailedPath(string $path) { if ($this->root === '') { return $path; } @@ -296,8 +296,11 @@ public function getIncomplete() { * @param int $id * @return string|null */ - public function getPathById($id) { + public function getPathById($id): ?string { $path = $this->cache->getPathById($id); + if ($path === null) { + return null; + } return $this->getJailedPath($path); } diff --git a/lib/private/Files/External/ConfigAdapter.php b/lib/private/Files/External/ConfigAdapter.php index 448b0e018adf..dd544dfc1d53 100644 --- a/lib/private/Files/External/ConfigAdapter.php +++ b/lib/private/Files/External/ConfigAdapter.php @@ -187,10 +187,10 @@ public function getMountsForUser(IUser $user, IStorageFactory $loader) { * fill in the correct values for $user * * @param string $user user value - * @param string|array $input + * @param array|string $input * @return string */ - private function setUserVars($user, $input) { + private function setUserVars(string $user, array|string $input): array|string { if (\is_array($input)) { foreach ($input as $key => $value) { if (\is_string($value)) { diff --git a/lib/private/Files/External/StorageConfig.php b/lib/private/Files/External/StorageConfig.php index 936f5628ef0c..407dff485551 100644 --- a/lib/private/Files/External/StorageConfig.php +++ b/lib/private/Files/External/StorageConfig.php @@ -391,10 +391,8 @@ public function setType($type) { /** * Serialize config to JSON - * - * @return array */ - public function jsonSerialize() { + public function jsonSerialize(): array { $result = []; if ($this->id !== null) { $result['id'] = $this->id; diff --git a/lib/private/Files/FileInfo.php b/lib/private/Files/FileInfo.php index 1a3d927e566d..a2ff1f7f16f9 100644 --- a/lib/private/Files/FileInfo.php +++ b/lib/private/Files/FileInfo.php @@ -85,30 +85,32 @@ public function __construct($path, $storage, $internalPath, $data, $mount, $owne $this->owner = $owner; } - public function offsetSet($offset, $value) { + public function offsetSet($offset, $value): void { $this->data[$offset] = $value; } - public function offsetExists($offset) { + public function offsetExists($offset): bool { return isset($this->data[$offset]); } - public function offsetUnset($offset) { + public function offsetUnset($offset): void { unset($this->data[$offset]); } - public function offsetGet($offset) { + public function offsetGet($offset): mixed { if ($offset === 'type') { return $this->getType(); - } elseif ($offset === 'etag') { + } + + if ($offset === 'etag') { return $this->getEtag(); - } elseif ($offset === 'permissions') { + } + + if ($offset === 'permissions') { return $this->getPermissions(); - } elseif (isset($this->data[$offset])) { - return $this->data[$offset]; - } else { - return null; } + + return $this->data[$offset] ?? null; } /** @@ -341,6 +343,6 @@ public function addSubEntry($data, $entryPath) { * @inheritdoc */ public function getChecksum() { - return $this->data['checksum']; + return $this->data['checksum'] ?? ''; } } diff --git a/lib/private/Files/Storage/Wrapper/Encryption.php b/lib/private/Files/Storage/Wrapper/Encryption.php index 906568d088da..b859608dd70f 100644 --- a/lib/private/Files/Storage/Wrapper/Encryption.php +++ b/lib/private/Files/Storage/Wrapper/Encryption.php @@ -988,9 +988,9 @@ protected function getHeaderSize($path) { $path = $realFile; } } - $firstBlock = $this->readFirstBlock($path); + $firstBlock = $this->readFirstBlock($path) ?? ''; - if (\substr($firstBlock, 0, \strlen(Util::HEADER_START)) === Util::HEADER_START) { + if (str_starts_with($firstBlock, Util::HEADER_START)) { $headerSize = $this->util->getHeaderSize(); } diff --git a/lib/private/Files/Stream/Close.php b/lib/private/Files/Stream/Close.php index 4810d01150a8..421173d2bc2e 100644 --- a/lib/private/Files/Stream/Close.php +++ b/lib/private/Files/Stream/Close.php @@ -28,6 +28,7 @@ * stream wrapper that provides a callback on stream close */ class Close { + public $context; private static $callBacks = []; private $path = ''; private $source; diff --git a/lib/private/Files/Stream/Dir.php b/lib/private/Files/Stream/Dir.php index 8b0034e0fb81..38735745bc72 100644 --- a/lib/private/Files/Stream/Dir.php +++ b/lib/private/Files/Stream/Dir.php @@ -28,6 +28,7 @@ class Dir { private static $dirs = []; private $name; private $index; + public $context; public function dir_opendir($path, $options) { $this->name = \substr($path, \strlen('fakedir://')); diff --git a/lib/private/Files/Stream/Encryption.php b/lib/private/Files/Stream/Encryption.php index 7ec3b2d6cccd..9c3244c2bd91 100644 --- a/lib/private/Files/Stream/Encryption.php +++ b/lib/private/Files/Stream/Encryption.php @@ -99,6 +99,9 @@ class Encryption extends Wrapper { /** @var array */ protected $expectedContextProperties; + /** @var string - keep this for property access in L224*/ + protected $sourceFileOfRename; + public function __construct() { $this->expectedContextProperties = [ 'source', @@ -199,11 +202,8 @@ public static function wrap( protected static function wrapSource($source, $context = [], $protocol = null, $class = null, $mode = 'r+') { try { \stream_wrapper_register($protocol, $class); - if (@\rewinddir($source) === false) { - $wrapped = \fopen($protocol . '://', $mode, false, $context); - } else { - $wrapped = \opendir($protocol . '://', $context); - } + \rewind($source); + $wrapped = \fopen($protocol . '://', $mode, false, $context); } catch (\BadMethodCallException $e) { \stream_wrapper_unregister($protocol); throw $e; diff --git a/lib/private/Files/Stream/Quota.php b/lib/private/Files/Stream/Quota.php index 1cb7c4c77370..2964da6a7d1c 100644 --- a/lib/private/Files/Stream/Quota.php +++ b/lib/private/Files/Stream/Quota.php @@ -32,6 +32,7 @@ * or: resource \OC\Files\Stream\Quota::wrap($stream, $limit) */ class Quota { + public $context; private static $streams = []; /** @@ -66,7 +67,7 @@ public static function clear() { * @return resource */ public static function wrap($stream, $limit) { - $id = \uniqid(); + $id = \uniqid('', true); self::register($id, $stream, $limit); $meta = \stream_get_meta_data($stream); return \fopen('quota://' . $id, $meta['mode']); @@ -77,9 +78,9 @@ public function stream_open($path, $mode, $options, &$opened_path) { if (isset(self::$streams[$id])) { list($this->source, $this->limit) = self::$streams[$id]; return true; - } else { - return false; } + + return false; } public function stream_seek($offset, $whence = SEEK_SET) { diff --git a/lib/private/Files/View.php b/lib/private/Files/View.php index 9bd55a420c3b..f46b2213023d 100644 --- a/lib/private/Files/View.php +++ b/lib/private/Files/View.php @@ -388,15 +388,15 @@ public function rmdir($path) { * * @return bool */ - protected function isShareFolderOrShareFolderParent($path) { - $shareFolder = \trim($this->config->getSystemValue('share_folder', '/'), '/'); + protected function isShareFolderOrShareFolderParent($path): bool { + $shareFolder = \trim($this->config->getSystemValue('share_folder', '/') ?? '', '/'); if ($shareFolder === '') { return false; } $user = \OC_User::getUser(); $shareFolderAbsolutePath = "/$user/files/$shareFolder"; $trimmedAbsolutePath = $this->getAbsolutePath(\trim($path, '/')); - return $shareFolderAbsolutePath === $trimmedAbsolutePath || \strpos($shareFolderAbsolutePath, "$trimmedAbsolutePath/") === 0; + return $shareFolderAbsolutePath === $trimmedAbsolutePath || \str_starts_with($shareFolderAbsolutePath, "$trimmedAbsolutePath/"); } /** @@ -1439,7 +1439,7 @@ public function getFileInfo($path, $includeMountPoints = true) { if (!Filesystem::isValidPath($path)) { return false; } - if (Cache\Scanner::isPartialFile($path)) { + if (Cache\Scanner::isPartialFile($path ?? '')) { return $this->getPartFileInfo($path); } $relativePath = $path; @@ -1972,7 +1972,7 @@ public function verifyPath($path, $fileName) { * @return string[] */ private function getParents($path) { - $path = \trim($path, '/'); + $path = \trim($path ?? '', '/'); if (!$path) { return []; } diff --git a/lib/private/Image/BmpToResource.php b/lib/private/Image/BmpToResource.php index 4eb87814aa61..b62ab6edf47c 100644 --- a/lib/private/Image/BmpToResource.php +++ b/lib/private/Image/BmpToResource.php @@ -46,8 +46,7 @@ class BmpToResource { /** @var string[][] $pixelArray */ private $pixelArray; - /** @var resource $resource */ - private $resource; + private \GdImage $resource; /** @var array $bytesPerDepth */ private $bytesPerDepth = [ @@ -69,10 +68,9 @@ public function __construct($fileName) { } /** - * @return resource * @throws \Exception */ - public function toResource() { + public function toResource(): \GdImage { try { $this->header = $this->readBitmapHeader(); $this->header += $this->readDibHeader(); @@ -87,10 +85,11 @@ public function toResource() { $this->pixelArray = $this->readPixelArray(); // create gd image - $this->resource = \imagecreatetruecolor($this->header['width'], $this->header['height']); - if ($this->resource === false) { + $resource = \imagecreatetruecolor($this->header['width'], $this->header['height']); + if ($resource === false) { throw new \RuntimeException('imagecreatetruecolor failed for file ' . $this->getFilename() . '" with dimensions ' . $this->header['width'] . 'x' . $this->header['height']); } + $this->resource = $resource; $this->pixelArrayToImage(); } catch (\Exception $e) { @@ -149,7 +148,7 @@ private function readDibHeader() { } $validBitDepth = \array_keys($this->bytesPerDepth); - if (!\in_array($dibHeader['bits'], $validBitDepth)) { + if (!\in_array($dibHeader['bits'], $validBitDepth, true)) { throw new \UnexpectedValueException('Bit Depth ' . $dibHeader['bits'] . ' in ' . $this->getFilename() . ' is not supported'); } @@ -159,7 +158,7 @@ private function readDibHeader() { private function fixImageSize($header) { // No compression - calculate it in our own if ($header['compression'] === self::COMPRESSION_BI_RGB) { - $bytesPerRow = \intval(\floor(($header['bits'] * $header['width'] + 31) / 32) * 4); + $bytesPerRow = (int)(\floor(($header['bits'] * $header['width'] + 31) / 32) * 4); $imageSize = $bytesPerRow * \abs($header['height']); } else { $imageSize = $this->file->getSize() - $this->header['offset']; @@ -196,7 +195,7 @@ private function readPixelArray() { $this->file->fseek($this->header['offset'], SEEK_SET); $pixelString = $this->readFile($this->header['imagesize']); - $bytesPerRow = \intval(\floor(($this->header['bits'] * $this->header['width'] + 31) / 32) * 4); + $bytesPerRow = (int)(\floor(($this->header['bits'] * $this->header['width'] + 31) / 32) * 4); $plainPixelArray = \str_split($pixelString, $bytesPerRow); // Positive height: Bottom row first. @@ -212,10 +211,7 @@ private function readPixelArray() { return $pixelArray; } - /** - * @return resource - */ - private function pixelArrayToImage() { + private function pixelArrayToImage(): \GdImage { $x = 0; $y = 0; foreach ($this->pixelArray as $pixelRow) { @@ -246,7 +242,7 @@ private function pixelArrayToImage() { private function getColors($raw) { $extra = \chr(0); // used to complement an argument to word or double word $colors = []; - if (\in_array($this->header['bits'], [32, 24])) { + if (\in_array($this->header['bits'], [32, 24], true)) { $colors = @\unpack('V', $raw . $extra); } elseif ($this->header['bits'] === 16) { $colors = @\unpack('v', $raw); @@ -264,8 +260,7 @@ function ($i) { ); } - $colors = \array_values($colors); - return $colors; + return \array_values($colors); } /** diff --git a/lib/private/IntegrityCheck/Checker.php b/lib/private/IntegrityCheck/Checker.php index f69de935766f..610e99e22595 100644 --- a/lib/private/IntegrityCheck/Checker.php +++ b/lib/private/IntegrityCheck/Checker.php @@ -38,6 +38,7 @@ use OCP\IConfig; use OCP\ITempManager; use phpseclib3\Crypt\RSA; +use phpseclib3\Crypt\RSA\PrivateKey; use phpseclib3\File\X509; /** @@ -342,7 +343,11 @@ private function verify($signaturePath, $basePath, $certificateCN, $force = fals return []; } - $signatureData = \json_decode($this->fileAccessHelper->file_get_contents($signaturePath), true); + $content = $this->fileAccessHelper->file_get_contents($signaturePath); + if (!$content) { + throw new MissingSignatureException('Signature data not found.'); + } + $signatureData = \json_decode($content, true); if (!\is_array($signatureData)) { throw new MissingSignatureException('Signature data not found.'); } @@ -464,7 +469,8 @@ public function getResults() { return \json_decode($cachedResults, true); } - return \json_decode($this->getAppValue(self::CACHE_KEY, '{}'), true); + $v = $this->getAppValue(self::CACHE_KEY, '{}') ?? '{}'; + return \json_decode($v, true); } /** diff --git a/lib/private/IntegrityCheck/Iterator/ExcludeFileByNameFilterIterator.php b/lib/private/IntegrityCheck/Iterator/ExcludeFileByNameFilterIterator.php index 1d6e78bdcec5..651355a7134f 100644 --- a/lib/private/IntegrityCheck/Iterator/ExcludeFileByNameFilterIterator.php +++ b/lib/private/IntegrityCheck/Iterator/ExcludeFileByNameFilterIterator.php @@ -65,10 +65,7 @@ class ExcludeFileByNameFilterIterator extends \RecursiveFilterIterator { '|/core/js/mimetypelist.js$|', // this file can be regenerated with additional entries with occ maintenance:mimetype:update-js ]; - /** - * @return bool - */ - public function accept() { + public function accept(): bool { /** @var \SplFileInfo $current */ $current = $this->current(); diff --git a/lib/private/IntegrityCheck/Iterator/ExcludeFoldersByPathFilterIterator.php b/lib/private/IntegrityCheck/Iterator/ExcludeFoldersByPathFilterIterator.php index b3030f6b74f8..58437fcae528 100644 --- a/lib/private/IntegrityCheck/Iterator/ExcludeFoldersByPathFilterIterator.php +++ b/lib/private/IntegrityCheck/Iterator/ExcludeFoldersByPathFilterIterator.php @@ -49,10 +49,7 @@ public function __construct(\RecursiveIterator $iterator, $root = '') { $this->excludedFolders = \array_merge($excludedFolders, $appFolders); } - /** - * @return bool - */ - public function accept() { + public function accept(): bool { return !\in_array( $this->current()->getPathName(), $this->excludedFolders, diff --git a/lib/private/L10N/L10N.php b/lib/private/L10N/L10N.php index 9e663d84943c..cb88988d823f 100644 --- a/lib/private/L10N/L10N.php +++ b/lib/private/L10N/L10N.php @@ -70,14 +70,16 @@ public function getLanguageCode() { /** * Translating + * * @param string $text The text we need a translation for - * @param array $parameters default:array() Parameters for sprintf + * @param array|mixed $parameters default:array() Parameters for sprintf * @return string Translation or the same text * * Returns the translation. If no translation is found, $text will be * returned. */ - public function t($text, $parameters = []) { + public function t(string $text, $parameters = []): string { + $parameters = \is_array($parameters) ? $parameters : [$parameters]; return (string) new \OC_L10N_String($this, $text, $parameters); } diff --git a/lib/private/Lock/MemcacheLockingProvider.php b/lib/private/Lock/MemcacheLockingProvider.php index 27bd5b66f372..8682930bc0da 100644 --- a/lib/private/Lock/MemcacheLockingProvider.php +++ b/lib/private/Lock/MemcacheLockingProvider.php @@ -55,7 +55,7 @@ private function setTTL($path) { public function isLocked($path, $type) { $lockValue = $this->memcache->get($path); if ($type === self::LOCK_SHARED) { - return $lockValue > 0; + return (int)($lockValue) > 0; } if ($type === self::LOCK_EXCLUSIVE) { diff --git a/lib/private/Log/Owncloud.php b/lib/private/Log/Owncloud.php index 54f21dadde46..cecf7f21612b 100644 --- a/lib/private/Log/Owncloud.php +++ b/lib/private/Log/Owncloud.php @@ -68,71 +68,76 @@ public static function write($app, $message, $level, $conditionalLogFile = null) } public static function writeExtra($app, $message, $level, $conditionalLogFile, $extraFields = []) { - $config = \OC::$server->getSystemConfig(); - - // default to ISO8601 - $format = $config->getValue('logdateformat', 'c'); - $logTimeZone = $config->getValue("logtimezone", 'UTC'); try { - $timezone = new \DateTimeZone($logTimeZone); - } catch (\Exception $e) { - $timezone = new \DateTimeZone('UTC'); - } - $time = \DateTime::createFromFormat("U.u", \number_format(\microtime(true), 4, ".", "")); - if ($time === false) { - $time = new \DateTime(null, $timezone); - } else { - // apply timezone if $time is created from UNIX timestamp - $time->setTimezone($timezone); - } - $request = \OC::$server->getRequest(); - $reqId = $request->getId(); - $remoteAddr = $request->getRemoteAddress(); - // remove username/passwords from URLs before writing the to the log file - $time = $time->format($format); - $url = ($request->getRequestUri() !== '') ? $request->getRequestUri() : '--'; - $method = \is_string($request->getMethod()) ? $request->getMethod() : '--'; - if (\OC::$server->getConfig()->getSystemValue('installed', false)) { - $user = (\OC_User::getUser()) ? \OC_User::getUser() : '--'; - } else { - $user = '--'; - } - $entry = \compact( - 'reqId', - 'level', - 'time', - 'remoteAddr', - 'user', - 'app', - 'method', - 'url', - 'message' - ); + $config = \OC::$server->getSystemConfig(); - if (!empty($extraFields)) { - // augment with additional fields - $entry = \array_merge($entry, $extraFields); - } + // default to ISO8601 + $format = $config->getValue('logdateformat', 'c'); + $logTimeZone = $config->getValue("logtimezone", 'UTC'); + try { + $timezone = new \DateTimeZone($logTimeZone); + } catch (\Exception $e) { + $timezone = new \DateTimeZone('UTC'); + } + $time = \DateTime::createFromFormat("U.u", \number_format(\microtime(true), 4, ".", "")); + if ($time === false) { + $time = new \DateTime(null, $timezone); + } else { + // apply timezone if $time is created from UNIX timestamp + $time->setTimezone($timezone); + } + $request = \OC::$server->getRequest(); + $reqId = $request->getId(); + $remoteAddr = $request->getRemoteAddress(); + // remove username/passwords from URLs before writing the to the log file + $time = $time->format($format); + $url = ($request->getRequestUri() !== '') ? $request->getRequestUri() : '--'; + $method = \is_string($request->getMethod()) ? $request->getMethod() : '--'; + if (\OC::$server->getConfig()->getSystemValue('installed', false)) { + $user = (\OC_User::getUser()) ? \OC_User::getUser() : '--'; + } else { + $user = '--'; + } + $entry = \compact( + 'reqId', + 'level', + 'time', + 'remoteAddr', + 'user', + 'app', + 'method', + 'url', + 'message' + ); - $entry = \json_encode($entry); - if ($conditionalLogFile !== null) { - if ($conditionalLogFile[0] !== '/') { - $conditionalLogFile = \OC::$server->getConfig()->getSystemValue('datadirectory') . "/" . $conditionalLogFile; + if (!empty($extraFields)) { + // augment with additional fields + $entry = \array_merge($entry, $extraFields); } - self::createLogFile($conditionalLogFile); - $handle = @\fopen($conditionalLogFile, 'a'); - } else { - self::createLogFile(self::$logFile); - $handle = @\fopen(self::$logFile, 'a'); - } - if ($handle) { - \fwrite($handle, $entry."\n"); - \fclose($handle); - } else { - // Fall back to error_log - \error_log($entry); - } - if (\php_sapi_name() === 'cli-server') { + + $entry = \json_encode($entry); + if ($conditionalLogFile !== null) { + if ($conditionalLogFile[0] !== '/') { + $conditionalLogFile = \OC::$server->getConfig()->getSystemValue('datadirectory') . "/" . $conditionalLogFile; + } + self::createLogFile($conditionalLogFile); + $handle = @\fopen($conditionalLogFile, 'a'); + } else { + self::createLogFile(self::$logFile); + $handle = @\fopen(self::$logFile, 'a'); + } + if ($handle) { + \fwrite($handle, $entry."\n"); + \fclose($handle); + } else { + // Fall back to error_log + \error_log($entry); + } + if (\php_sapi_name() === 'cli-server') { + \error_log($message, 4); + } + } catch(\Exception $ex) { + \error_log($ex->getMessage()); \error_log($message, 4); } } diff --git a/lib/private/Mail/Logger.php b/lib/private/Mail/Logger.php new file mode 100644 index 000000000000..81f0240f3913 --- /dev/null +++ b/lib/private/Mail/Logger.php @@ -0,0 +1,20 @@ +log[] = [$level, $message, $context]; + } + + /** + * @throws \JsonException + */ + public function toJSON(): string { + return json_encode($this->log, JSON_THROW_ON_ERROR); + } +} diff --git a/lib/private/Mail/Mailer.php b/lib/private/Mail/Mailer.php index 62b33d89f22d..8a5f3eed175c 100644 --- a/lib/private/Mail/Mailer.php +++ b/lib/private/Mail/Mailer.php @@ -23,9 +23,17 @@ use Egulias\EmailValidator\EmailValidator; use Egulias\EmailValidator\Validation\RFCValidation; +use OC_Defaults; use OCP\IConfig; use OCP\Mail\IMailer; use OCP\ILogger; +use Psr\Log\LoggerInterface; +use Symfony\Component\Mailer\Exception\TransportExceptionInterface; +use Symfony\Component\Mailer\Transport\SendmailTransport; +use Symfony\Component\Mailer\Transport\Smtp\EsmtpTransport; +use Symfony\Component\Mailer\Transport\Smtp\Stream\SocketStream; +use Symfony\Component\Mailer\Transport\TransportInterface; +use Symfony\Component\Mime\Email; /** * Class Mailer provides some basic functions to create a mail message that can be used in combination with @@ -46,24 +54,15 @@ * @package OC\Mail */ class Mailer implements IMailer { - /** @var \Swift_SmtpTransport|\Swift_SendmailTransport Cached transport */ - private $instance = null; - /** @var IConfig */ - private $config; - /** @var ILogger */ - private $logger; - /** @var \OC_Defaults */ - private $defaults; + private ?TransportInterface $instance = null; + private IConfig $config; + private ILogger $logger; + private OC_Defaults $defaults; - /** - * @param IConfig $config - * @param ILogger $logger - * @param \OC_Defaults $defaults - */ public function __construct( IConfig $config, ILogger $logger, - \OC_Defaults $defaults + OC_Defaults $defaults ) { $this->config = $config; $this->logger = $logger; @@ -72,11 +71,9 @@ public function __construct( /** * Creates a new message object that can be passed to send() - * - * @return Message */ - public function createMessage() { - return new Message(new \Swift_Message()); + public function createMessage(): Message { + return new Message(new Email()); } /** @@ -89,18 +86,34 @@ public function createMessage() { * @throws \Exception In case it was not possible to send the message. (for example if an invalid mail address * has been supplied.) */ - public function send(Message $message) { - $debugMode = $this->config->getSystemValue('mail_smtpdebug', false); - + public function send(Message $message): array { if (!\is_array($message->getFrom()) || \count($message->getFrom()) === 0) { $message->setFrom([\OCP\Util::getDefaultEmailAddress($this->defaults->getName())]); } - $failedRecipients = []; - - $mailer = $this->getInstance(); - - $mailer->send($message->getSwiftMessage(), $failedRecipients); + $debugMode = $this->config->getSystemValue('mail_smtpdebug', false); + $logger = $debugMode ? new Logger() : null; + + try { + $this->getInstance($logger ?? null)->send($message->getMessage()); + } catch (TransportExceptionInterface $e) { + # in case of exception it is expected that none of the mails has been sent + $failedRecipients = []; + + $recipients = array_merge($message->getTo(), $message->getCc(), $message->getBcc()); + array_walk($recipients, static function ($value, $key) use (&$failedRecipients) { + if (is_numeric($key)) { + $failedRecipients[] = $value; + } else { + $failedRecipients[] = $key; + } + }); + + $this->logger->logException($e, ['failed-recipients' => $recipients]); + + # list of failed recipients is not added by intention to not accidentally disclose private data + throw new \RuntimeException("Failed to deliver email", 0, $e); + } $allRecipients = []; if (!empty($message->getTo())) { @@ -119,10 +132,11 @@ public function send(Message $message) { 'app' => 'core', 'from' => \json_encode($message->getFrom()), 'recipients' => \json_encode($allRecipients), - 'subject' => $message->getSubject() + 'subject' => $message->getSubject(), + 'mail_log' => ($logger !== null) ? $logger->toJSON() : null, ]); - return $failedRecipients; + return []; } /** @@ -131,9 +145,9 @@ public function send(Message $message) { * @param string $email Email address to be validated * @return bool True if the mail address is valid, false otherwise */ - public function validateMailAddress($email) { - $validator = new EmailValidator(); - return $validator->isValid($this->convertEmail($email), new RFCValidation()); + public function validateMailAddress(string $email): bool { + return (new EmailValidator()) + ->isValid($this->convertEmail($email), new RFCValidation()); } /** @@ -144,12 +158,12 @@ public function validateMailAddress($email) { * @param string $email * @return string Converted mail address if `idn_to_ascii` exists */ - protected function convertEmail($email) { + protected function convertEmail(string $email): string { if (!\function_exists('idn_to_ascii') || \strpos($email, '@') === false) { return $email; } - list($name, $domain) = \explode('@', $email, 2); + [$name, $domain] = \explode('@', $email, 2); if (\defined('INTL_IDNA_VARIANT_UTS46')) { $domain = \idn_to_ascii($domain, 0, INTL_IDNA_VARIANT_UTS46); } else { @@ -158,80 +172,50 @@ protected function convertEmail($email) { return $name.'@'.$domain; } - /** - * Returns whatever transport is configured within the config - * - * @return \Swift_SmtpTransport|\Swift_SendmailTransport - */ - protected function getInstance() { + protected function getInstance(?LoggerInterface $logger = null): TransportInterface { if ($this->instance !== null) { return $this->instance; } $mailMode = $this->config->getSystemValue('mail_smtpmode', 'php'); if ($mailMode === 'smtp') { - $instance = $this->getSmtpInstance(); + $transport = $this->getSmtpInstance($logger ?? null); } else { - // FIXME: Move into the return statement but requires proper testing - // for SMTP and mail as well. Thus not really doable for a - // minor release. - $instance = new \Swift_Mailer($this->getSendMailInstance()); - } - - // Register plugins - - // Enable logger if debug mode is enabled - if ($this->config->getSystemValue('mail_smtpdebug', false)) { - $mailLogger = new \Swift_Plugins_Loggers_ArrayLogger(); - $instance->registerPlugin(new \Swift_Plugins_LoggerPlugin($mailLogger)); + $transport = $this->getSendMailInstance($logger ?? null); } - // Enable antiflood on smtp connection (defaults to 100 mails before reconnect) - $instance->registerPlugin(new \Swift_Plugins_AntiFloodPlugin()); - - $this->instance = $instance; + $this->instance = $transport; return $this->instance; } - /** - * Returns the SMTP transport - * - * @return \Swift_SmtpTransport - */ - protected function getSmtpInstance() { - $transport = new \Swift_SmtpTransport(); - $transport->setTimeout($this->config->getSystemValue('mail_smtptimeout', 10)); - $transport->setHost($this->config->getSystemValue('mail_smtphost', '127.0.0.1')); - $transport->setPort($this->config->getSystemValue('mail_smtpport', 25)); + protected function getSmtpInstance(?LoggerInterface $logger): EsmtpTransport { + $timeout = $this->config->getSystemValue('mail_smtptimeout', 10); + $host = $this->config->getSystemValue('mail_smtphost', '127.0.0.1'); + $port = $this->config->getSystemValue('mail_smtpport', 25); + $smtpSecurity = $this->config->getSystemValue('mail_smtpsecure', ''); + $tls = $smtpSecurity === 'ssl' ? true : null; + $transport = new EsmtpTransport($host, $port, $tls, null, $logger); if ($this->config->getSystemValue('mail_smtpauth', false)) { $transport->setUsername($this->config->getSystemValue('mail_smtpname', '')); $transport->setPassword($this->config->getSystemValue('mail_smtppassword', '')); - $transport->setAuthMode($this->config->getSystemValue('mail_smtpauthtype', 'LOGIN')); } - $smtpSecurity = $this->config->getSystemValue('mail_smtpsecure', ''); - if (!empty($smtpSecurity)) { - $transport->setEncryption($smtpSecurity); + $stream = $transport->getStream(); + if ($stream instanceof SocketStream) { + $stream->setTimeout($timeout); } - $transport->start(); + return $transport; } - /** - * Returns the sendmail transport - * - * @return \Swift_SendmailTransport - */ - protected function getSendMailInstance() { - switch ($this->config->getSystemValue('mail_smtpmode', 'sendmail')) { - case 'qmail': - $binaryPath = '/var/qmail/bin/sendmail'; - break; - default: - $binaryPath = '/usr/sbin/sendmail'; - break; + protected function getSendMailInstance(?LoggerInterface $logger = null): SendmailTransport { + $i = $this->config->getSystemValue('mail_smtpmode', 'sendmail'); + if ($i === 'qmail') { + $binaryPath = '/var/qmail/bin/sendmail'; + } else { + $binaryPath = '/usr/sbin/sendmail'; } - return new \Swift_SendmailTransport($binaryPath . ' -bs'); + return new SendmailTransport($binaryPath . ' -bs', null, $logger); } } diff --git a/lib/private/Mail/Message.php b/lib/private/Mail/Message.php index 12633ff76ad6..88ce719abf07 100644 --- a/lib/private/Mail/Message.php +++ b/lib/private/Mail/Message.php @@ -22,55 +22,38 @@ namespace OC\Mail; -use Swift_Message; +use Symfony\Component\Mime\Address; +use Symfony\Component\Mime\Email; /** - * Class Message provides a wrapper around SwiftMail + * Class Message provides a wrapper around Symfony\Component\Mime\Email * * @package OC\Mail */ class Message { - /** @var Swift_Message */ - private $swiftMessage; + private Email $message; + private array $from = []; + private array $replyTo = []; + private array $to = []; + private array $cc = []; + private array $bcc = []; - /** - * @param Swift_Message $swiftMessage - */ - public function __construct(Swift_Message $swiftMessage) { - $this->swiftMessage = $swiftMessage; + public function __construct(Email $swiftMessage) { + $this->message = $swiftMessage; } /** - * SwiftMailer does currently not work with IDN domains, this function therefore converts the domains - * FIXME: Remove this once SwiftMailer supports IDN - * * @param array $addresses Array of mail addresses, key will get converted - * @return array Converted addresses if `idn_to_ascii` exists + * @return Address[] Converted addresses if `idn_to_ascii` exists */ - protected function convertAddresses($addresses) { - if (!\function_exists('idn_to_ascii')) { - return $addresses; - } - + protected function convertAddresses(array $addresses): array { $convertedAddresses = []; foreach ($addresses as $email => $readableName) { - if (!\is_numeric($email)) { - list($name, $domain) = \explode('@', $email, 2); - if (\defined('INTL_IDNA_VARIANT_UTS46')) { - $domain = \idn_to_ascii($domain, 0, INTL_IDNA_VARIANT_UTS46); - } else { - $domain = \idn_to_ascii($domain); - } - $convertedAddresses[$name.'@'.$domain] = $readableName; + if (\is_numeric($email)) { + $convertedAddresses[] = new Address($readableName); } else { - list($name, $domain) = \explode('@', $readableName, 2); - if (\defined('INTL_IDNA_VARIANT_UTS46')) { - $domain = \idn_to_ascii($domain, 0, INTL_IDNA_VARIANT_UTS46); - } else { - $domain = \idn_to_ascii($domain); - } - $convertedAddresses[$email] = $name.'@'.$domain; + $convertedAddresses[] = new Address($email, $readableName ?? ''); } } @@ -83,12 +66,11 @@ protected function convertAddresses($addresses) { * If no "From" address is used \OC\Mail\Mailer will use mail_from_address and mail_domain from config.php * * @param array $addresses Example: array('sender@domain.org', 'other@domain.org' => 'A name') - * @return $this */ - public function setFrom(array $addresses) { - $addresses = $this->convertAddresses($addresses); + public function setFrom(array $addresses): Message { + $this->message->from(...$this->convertAddresses($addresses)); - $this->swiftMessage->setFrom($addresses); + $this->from = $addresses; return $this; } @@ -97,42 +79,36 @@ public function setFrom(array $addresses) { * * @return array */ - public function getFrom() { - return $this->swiftMessage->getFrom(); + public function getFrom(): array { + return $this->from; } /** * Set the Reply-To address of this message - * - * @param array $addresses - * @return $this */ - public function setReplyTo(array $addresses) { - $addresses = $this->convertAddresses($addresses); + public function setReplyTo(array $addresses): Message { + $this->message->replyTo(...$this->convertAddresses($addresses)); - $this->swiftMessage->setReplyTo($addresses); + $this->replyTo = $addresses; return $this; } /** * Returns the Reply-To address of this message - * - * @return array */ - public function getReplyTo() { - return $this->swiftMessage->getReplyTo(); + public function getReplyTo(): array { + return $this->replyTo; } /** - * Set the to addresses of this message. + * Set the to-addresses of this message. * * @param array $recipients Example: array('recipient@domain.org', 'other@domain.org' => 'A name') - * @return $this */ - public function setTo(array $recipients) { - $recipients = $this->convertAddresses($recipients); + public function setTo(array $recipients): Message { + $this->message->to(...$this->convertAddresses($recipients)); - $this->swiftMessage->setTo($recipients); + $this->to = $recipients; return $this; } @@ -141,82 +117,68 @@ public function setTo(array $recipients) { * * @return array */ - public function getTo() { - return $this->swiftMessage->getTo(); + public function getTo(): array { + return $this->to; } /** * Set the CC recipients of this message. * * @param array $recipients Example: array('recipient@domain.org', 'other@domain.org' => 'A name') - * @return $this */ - public function setCc(array $recipients) { - $recipients = $this->convertAddresses($recipients); + public function setCc(array $recipients): Message { + $this->message->cc(...$this->convertAddresses($recipients)); - $this->swiftMessage->setCc($recipients); + $this->cc = $recipients; return $this; } /** * Get the cc address of this message. - * - * @return array */ - public function getCc() { - return $this->swiftMessage->getCc(); + public function getCc(): array { + return $this->cc; } /** * Set the BCC recipients of this message. * * @param array $recipients Example: array('recipient@domain.org', 'other@domain.org' => 'A name') - * @return $this */ - public function setBcc(array $recipients) { - $recipients = $this->convertAddresses($recipients); + public function setBcc(array $recipients): Message { + $this->message->bcc(...$this->convertAddresses($recipients)); - $this->swiftMessage->setBcc($recipients); + $this->bcc = $recipients; return $this; } /** * Get the Bcc address of this message. - * - * @return array */ - public function getBcc() { - return $this->swiftMessage->getBcc(); + public function getBcc(): array { + return $this->bcc; } /** * Set the subject of this message. - * - * @param $subject - * @return $this */ - public function setSubject($subject) { - $this->swiftMessage->setSubject($subject); + public function setSubject(string $subject): Message { + $this->message->subject($subject); return $this; } /** - * Get the from subject of this message. - * - * @return string + * Get the subject of this message. */ - public function getSubject() { - return $this->swiftMessage->getSubject(); + public function getSubject(): string { + return $this->message->getSubject(); } /** * Set the plain-text body of this message. - * - * @param string $body - * @return $this */ - public function setPlainBody($body) { - $this->swiftMessage->setBody($body); + public function setPlainBody(string $body): Message { + $this->message->text($body); return $this; } @@ -225,8 +187,8 @@ public function setPlainBody($body) { * * @return string */ - public function getPlainBody() { - return $this->swiftMessage->getBody(); + public function getPlainBody(): string { + return $this->message->getTextBody() ?? ''; } /** @@ -235,26 +197,27 @@ public function getPlainBody() { * @param string $body * @return $this */ - public function setHtmlBody($body) { - $this->swiftMessage->addPart($body, 'text/html'); + public function setHtmlBody(string $body): Message { + $this->message->html($body); return $this; } - /** - * Get's the underlying SwiftMessage - * @return Swift_Message - */ - public function getSwiftMessage() { - return $this->swiftMessage; + public function getMessage(): Email { + return $this->message; } - /** - * @param string $body - * @param string $contentType - * @return $this - */ - public function setBody($body, $contentType) { - $this->swiftMessage->setBody($body, $contentType); + public function setBody(string $body, string $contentType): Message { + if ($contentType === 'text/html') { + $this->message->html($body); + } else { + $this->message->text($body); + } + + return $this; + } + + public function attach($body, string $name = null, string $contentType = null): self { + $this->message->attach($body, $name, $contentType); return $this; } } diff --git a/lib/private/Memcache/APCu.php b/lib/private/Memcache/APCu.php index c3fdc6f15b9b..b14c53763767 100644 --- a/lib/private/Memcache/APCu.php +++ b/lib/private/Memcache/APCu.php @@ -35,7 +35,7 @@ class APCu extends Cache implements IMemcache { use CADTrait; - public function get($key) { + public function get($key): mixed { $result = \apcu_fetch($this->getPrefix() . $key, $success); if (!$success) { return null; @@ -43,7 +43,7 @@ public function get($key) { return $result; } - public function set($key, $value, $ttl = 0) { + public function set($key, $value, $ttl = 0): mixed { return \apcu_store($this->getPrefix() . $key, $value, $ttl); } @@ -58,7 +58,8 @@ public function remove($key) { public function clear($prefix = '') { $ns = $this->getPrefix() . $prefix; $ns = \preg_quote($ns, '/'); - $iter = new \APCuIterator('/^' . $ns . '/', APC_ITER_KEY); + $iter = new \APCUIterator('/^' . $ns . '/', APC_ITER_KEY); + return \apcu_delete($iter); } @@ -105,7 +106,7 @@ public function dec($key, $step = 1) { * @param mixed $new * @return bool */ - public function cas($key, $old, $new) { + public function cas($key, $old, $new): bool { // apc only does cas for ints if (\is_int($old) && \is_int($new)) { return \apcu_cas($this->getPrefix() . $key, $old, $new); @@ -117,7 +118,7 @@ public function cas($key, $old, $new) { /** * @return bool */ - public static function isAvailable() { + public static function isAvailable(): bool { if (!\extension_loaded('apcu')) { return false; } diff --git a/lib/private/Memcache/ArrayCache.php b/lib/private/Memcache/ArrayCache.php index b5e0bd8b2604..41d164c4758f 100644 --- a/lib/private/Memcache/ArrayCache.php +++ b/lib/private/Memcache/ArrayCache.php @@ -28,14 +28,14 @@ class ArrayCache extends Cache implements IMemcache { /** @var array Array with the cached data */ - protected $cachedData = []; + protected array $cachedData = []; use CADTrait; /** * {@inheritDoc} */ - public function get($key) { + public function get($key): mixed { if ($this->hasKey($key)) { return $this->cachedData[$key]; } @@ -45,7 +45,7 @@ public function get($key) { /** * {@inheritDoc} */ - public function set($key, $value, $ttl = 0) { + public function set($key, $value, $ttl = 0): mixed { $this->cachedData[$key] = $value; return true; } @@ -94,9 +94,9 @@ public function add($key, $value, $ttl = 0) { // since this cache is not shared race conditions aren't an issue if ($this->hasKey($key)) { return false; - } else { - return $this->set($key, $value, $ttl); } + + return $this->set($key, $value, $ttl); } /** @@ -111,10 +111,10 @@ public function inc($key, $step = 1) { if (\is_int($oldValue)) { $this->set($key, $oldValue + $step); return $oldValue + $step; - } else { - $success = $this->add($key, $step); - return ($success) ? $step : false; } + + $success = $this->add($key, $step); + return ($success) ? $step : false; } /** @@ -129,9 +129,9 @@ public function dec($key, $step = 1) { if (\is_int($oldValue)) { $this->set($key, $oldValue - $step); return $oldValue - $step; - } else { - return false; } + + return false; } /** @@ -145,15 +145,12 @@ public function dec($key, $step = 1) { public function cas($key, $old, $new) { if ($this->get($key) === $old) { return $this->set($key, $new); - } else { - return false; } + + return false; } - /** - * {@inheritDoc} - */ - public static function isAvailable() { + public static function isAvailable(): bool { return true; } } diff --git a/lib/private/Memcache/Cache.php b/lib/private/Memcache/Cache.php index 99692026edd5..40696920f6ae 100644 --- a/lib/private/Memcache/Cache.php +++ b/lib/private/Memcache/Cache.php @@ -24,31 +24,23 @@ namespace OC\Memcache; -abstract class Cache implements \ArrayAccess, \OCP\ICache { - /** - * @var string $prefix - */ - protected $prefix; +use OCP\ICache; - /** - * @param string $prefix - */ - public function __construct($prefix = '') { +abstract class Cache implements \ArrayAccess, ICache { + protected string $prefix; + + public function __construct(string $prefix = '') { $this->prefix = $prefix; } /** * @return string Prefix used for caching purposes */ - public function getPrefix() { + public function getPrefix(): string { return $this->prefix; } - /** - * @param string $key - * @return mixed - */ - abstract public function get($key); + abstract public function get($key): mixed; /** * @param string $key @@ -56,7 +48,7 @@ abstract public function get($key); * @param int $ttl * @return mixed */ - abstract public function set($key, $value, $ttl = 0); + abstract public function set($key, $value, $ttl = 0): mixed; /** * @param string $key @@ -78,19 +70,19 @@ abstract public function clear($prefix = ''); //implement the ArrayAccess interface - public function offsetExists($offset) { + public function offsetExists($offset): bool { return $this->hasKey($offset); } - public function offsetSet($offset, $value) { + public function offsetSet($offset, $value): void { $this->set($offset, $value); } - public function offsetGet($offset) { + public function offsetGet($offset): mixed { return $this->get($offset); } - public function offsetUnset($offset) { + public function offsetUnset($offset): void { $this->remove($offset); } } diff --git a/lib/private/Memcache/Memcached.php b/lib/private/Memcache/Memcached.php index 5d80de578af6..337938ecc013 100644 --- a/lib/private/Memcache/Memcached.php +++ b/lib/private/Memcache/Memcached.php @@ -96,16 +96,16 @@ protected function getNamespace() { return $this->prefix; } - public function get($key) { + public function get($key): mixed { $result = self::$cache->get($this->getNamespace() . $key); - if ($result === false and self::$cache->getResultCode() == \Memcached::RES_NOTFOUND) { + if ($result === false && self::$cache->getResultCode() == \Memcached::RES_NOTFOUND) { return null; - } else { - return $result; } + + return $result; } - public function set($key, $value, $ttl = 0) { + public function set($key, $value, $ttl = 0): mixed { if ($ttl > 0) { $result = self::$cache->set($this->getNamespace() . $key, $value, $ttl); } else { diff --git a/lib/private/Memcache/NullCache.php b/lib/private/Memcache/NullCache.php index 792410710258..49c9aa6b2d19 100644 --- a/lib/private/Memcache/NullCache.php +++ b/lib/private/Memcache/NullCache.php @@ -25,12 +25,14 @@ namespace OC\Memcache; -class NullCache extends Cache implements \OCP\IMemcache { - public function get($key) { +use OCP\IMemcache; + +class NullCache extends Cache implements IMemcache { + public function get($key): mixed { return null; } - public function set($key, $value, $ttl = 0) { + public function set($key, $value, $ttl = 0): mixed { return true; } diff --git a/lib/private/Memcache/Redis.php b/lib/private/Memcache/Redis.php index d92bc5941221..67615b8655d3 100644 --- a/lib/private/Memcache/Redis.php +++ b/lib/private/Memcache/Redis.php @@ -45,33 +45,37 @@ protected function getNameSpace() { return $this->prefix; } - public function get($key) { + public function get($key): mixed { $result = self::$cache->get($this->getNameSpace() . $key); if ($result === false && !self::$cache->exists($this->getNameSpace() . $key)) { return null; - } else { - return \json_decode($result, true); } + + return \json_decode($result, true); } - public function set($key, $value, $ttl = 0) { + public function set($key, $value, $ttl = 0): mixed { if ($ttl > 0) { return self::$cache->setex($this->getNameSpace() . $key, $ttl, \json_encode($value)); - } else { - return self::$cache->set($this->getNameSpace() . $key, \json_encode($value)); } + + return self::$cache->set($this->getNameSpace() . $key, \json_encode($value)); } - public function hasKey($key) { - return self::$cache->exists($this->getNameSpace() . $key); + public function hasKey($key): bool { + $val = self::$cache->exists($this->getNameSpace() . $key); + if (\is_bool($val)) { + return $val; + } + return (int)$val > 0; } public function remove($key) { if (self::$cache->del($this->getNameSpace() . $key)) { return true; - } else { - return false; } + + return false; } public function clear($prefix = '') { diff --git a/lib/private/Preview.php b/lib/private/Preview.php index f409addfdbf3..e8d6fefae247 100644 --- a/lib/private/Preview.php +++ b/lib/private/Preview.php @@ -1116,7 +1116,7 @@ private function generatePreview() { $previewProviders = \OC::$server->getPreviewManager() ->getProviders(); foreach ($previewProviders as $supportedMimeType => $providers) { - if (!\preg_match($supportedMimeType, $this->mimeType)) { + if (!\preg_match($supportedMimeType, $this->mimeType ?? '')) { continue; } diff --git a/lib/private/Preview/Bitmap.php b/lib/private/Preview/Bitmap.php index e004f93c2cd1..b7f783c5cb38 100644 --- a/lib/private/Preview/Bitmap.php +++ b/lib/private/Preview/Bitmap.php @@ -58,7 +58,7 @@ public function getThumbnail(File $file, $maxX, $maxY, $scalingUp) { //new bitmap image object $image = new \OC_Image(); - $image->loadFromData($bp); + $image->loadFromData((string)$bp); //check if image object is valid return $image->valid() ? $image : false; } diff --git a/lib/private/Preview/Image.php b/lib/private/Preview/Image.php index 302ff2ff6a7a..a1c0b1cffa4e 100644 --- a/lib/private/Preview/Image.php +++ b/lib/private/Preview/Image.php @@ -41,7 +41,7 @@ public function getThumbnail(File $file, $maxX, $maxY, $scalingUp) { } $image = new \OC_Image(); $handle = $file->fopen('r'); - $image->load($handle); + $image->loadFromFileHandle($handle); $image->fixOrientation(); if (!$this->validateImageDimensions($image)) { return false; diff --git a/lib/private/Preview/Office.php b/lib/private/Preview/Office.php index 479211ae5bd2..d8f038279b23 100644 --- a/lib/private/Preview/Office.php +++ b/lib/private/Preview/Office.php @@ -77,7 +77,7 @@ public function getThumbnail(File $file, $maxX, $maxY, $scalingUp) { } $image = new \OC_Image(); - $image->loadFromData($imagick); + $image->loadFromData($imagick->getImageBlob()); \unlink($pdfPreview); diff --git a/lib/private/Preview/SVG.php b/lib/private/Preview/SVG.php index d7d385809366..00e474a47421 100644 --- a/lib/private/Preview/SVG.php +++ b/lib/private/Preview/SVG.php @@ -64,7 +64,7 @@ public function getThumbnail(File $file, $maxX, $maxY, $scalingUp) { //new image object $image = new \OC_Image(); - $image->loadFromData($imagick); + $image->loadFromData($imagick->getImageBlob()); //check if image object is valid if ($image->valid()) { $image->scaleDownToFit($maxX, $maxY); diff --git a/lib/private/Search/Result/File.php b/lib/private/Search/Result/File.php index 371e3f117617..17df1bd8efd6 100644 --- a/lib/private/Search/Result/File.php +++ b/lib/private/Search/Result/File.php @@ -67,6 +67,16 @@ class File extends \OCP\Search\Result { */ public $permissions; + /** + * @var float + */ + public $score; + + /** + * @var string[] + */ + public $highlights; + /** * Create a new file search result * @param FileInfo $data file data given by provider diff --git a/lib/private/Security/Crypto.php b/lib/private/Security/Crypto.php index 9e0ac67e7a4d..8ecac526bc43 100644 --- a/lib/private/Security/Crypto.php +++ b/lib/private/Security/Crypto.php @@ -112,12 +112,13 @@ public function encrypt($plaintext, $password = '') { /** * Decrypts a value and verifies the HMAC (Encrypt-Then-Mac) + * * @param string $authenticatedCiphertext * @param string $password Password to encrypt, if not specified the secret from config.php will be taken * @return string plaintext * @throws \Exception If the HMAC does not match */ - public function decrypt($authenticatedCiphertext, $password = '') { + public function decrypt(string $authenticatedCiphertext, string $password = ''): string { if ($password === '') { $password = $this->config->getSystemValue('secret'); } diff --git a/lib/private/Server.php b/lib/private/Server.php index 46172e9f0d97..3cc8bfa8cd78 100644 --- a/lib/private/Server.php +++ b/lib/private/Server.php @@ -730,9 +730,7 @@ public function __construct($webRoot, \OC\Config $config) { 'server' => $_SERVER, 'env' => $_ENV, 'cookies' => $_COOKIE, - 'method' => (isset($_SERVER, $_SERVER['REQUEST_METHOD'])) - ? $_SERVER['REQUEST_METHOD'] - : null, + 'method' => $_SERVER['REQUEST_METHOD'] ?? 'GET', 'urlParams' => $urlParams, ], $this->getSecureRandom(), diff --git a/lib/private/Session/CryptoSessionData.php b/lib/private/Session/CryptoSessionData.php index 233ba5f025c4..e989b1638014 100644 --- a/lib/private/Session/CryptoSessionData.php +++ b/lib/private/Session/CryptoSessionData.php @@ -33,16 +33,11 @@ * @package OC\Session */ class CryptoSessionData implements \ArrayAccess, ISession { - /** @var ISession */ - protected $session; - /** @var \OCP\Security\ICrypto */ - protected $crypto; - /** @var string */ - protected $passphrase; - /** @var array */ - protected $sessionValues; - /** @var bool */ - protected $isModified = false; + protected ISession $session; + protected ICrypto $crypto; + protected string $passphrase; + protected array $sessionValues; + protected bool $isModified = false; public const encryptedSessionName = 'encrypted_session_data'; /** @@ -67,20 +62,20 @@ public function __construct( public function __destruct() { try { $this->close(); - } catch (SessionNotAvailableException $e) { + } catch (SessionNotAvailableException) { // This exception can occur if session is already closed // So it is safe to ignore it and let the garbage collector to proceed } } - protected function initializeSession() { - $encryptedSessionData = $this->session->get(self::encryptedSessionName); + protected function initializeSession(): void { + $encryptedSessionData = $this->session->get(self::encryptedSessionName) ?? ''; try { $this->sessionValues = \json_decode( $this->crypto->decrypt($encryptedSessionData, $this->passphrase), true - ); - } catch (\Exception $e) { + ) ?? []; + } catch (\Exception) { $this->sessionValues = []; } } @@ -91,23 +86,16 @@ protected function initializeSession() { * @param string $key * @param mixed $value */ - public function set($key, $value) { + public function set($key, $value): void { $this->sessionValues[$key] = $value; $this->isModified = true; } /** * Get a value from the session - * - * @param string $key - * @return string|null Either the value or null */ - public function get($key) { - if (isset($this->sessionValues[$key])) { - return $this->sessionValues[$key]; - } - - return null; + public function get(string $key): mixed { + return $this->sessionValues[$key] ?? null; } /** @@ -116,7 +104,7 @@ public function get($key) { * @param string $key * @return bool */ - public function exists($key) { + public function exists($key): bool { return isset($this->sessionValues[$key]); } @@ -125,7 +113,7 @@ public function exists($key) { * * @param string $key */ - public function remove($key) { + public function remove($key): void { $this->isModified = true; unset($this->sessionValues[$key]); $this->session->remove(self::encryptedSessionName); @@ -134,7 +122,7 @@ public function remove($key) { /** * Reset and recreate the session */ - public function clear() { + public function clear(): void { $this->sessionValues = []; $this->isModified = true; $this->session->clear(); @@ -146,7 +134,7 @@ public function clear() { * @param bool $deleteOldSession Whether to delete the old associated session file or not. * @return void */ - public function regenerateId($deleteOldSession = true) { + public function regenerateId($deleteOldSession = true): void { $this->session->regenerateId($deleteOldSession); } @@ -157,14 +145,14 @@ public function regenerateId($deleteOldSession = true) { * @throws SessionNotAvailableException * @since 9.1.0 */ - public function getId() { + public function getId(): string { return $this->session->getId(); } /** * Close the session and release the lock, also writes all changed data in batch */ - public function close() { + public function close(): void { if ($this->isModified) { $encryptedValue = $this->crypto->encrypt(\json_encode($this->sessionValues), $this->passphrase); $this->session->set(self::encryptedSessionName, $encryptedValue); @@ -177,15 +165,15 @@ public function close() { * @param mixed $offset * @return bool */ - public function offsetExists($offset) { + public function offsetExists($offset): bool { return $this->exists($offset); } /** * @param mixed $offset - * @return mixed + * @return string|null */ - public function offsetGet($offset) { + public function offsetGet($offset): ?string { return $this->get($offset); } @@ -193,14 +181,14 @@ public function offsetGet($offset) { * @param mixed $offset * @param mixed $value */ - public function offsetSet($offset, $value) { + public function offsetSet($offset, mixed $value): void { $this->set($offset, $value); } /** * @param mixed $offset */ - public function offsetUnset($offset) { + public function offsetUnset($offset): void { $this->remove($offset); } } diff --git a/lib/private/Session/Internal.php b/lib/private/Session/Internal.php index 560410b576d7..2d4f91b83f0c 100644 --- a/lib/private/Session/Internal.php +++ b/lib/private/Session/Internal.php @@ -70,7 +70,7 @@ public function set($key, $value) { * @param string $key * @return mixed */ - public function get($key) { + public function get(string $key): mixed { if (!$this->exists($key)) { return null; } @@ -102,7 +102,7 @@ public function clear() { $_SESSION = []; } - public function close() { + public function close(): void { \session_write_close(); parent::close(); } diff --git a/lib/private/Session/Memory.php b/lib/private/Session/Memory.php index c9349a750bc7..307f0ad889c8 100644 --- a/lib/private/Session/Memory.php +++ b/lib/private/Session/Memory.php @@ -37,7 +37,7 @@ * @package OC\Session */ class Memory extends Session { - protected $data; + protected array $data; public function __construct() { //no need to use $name since all data is already scoped to this instance @@ -57,7 +57,7 @@ public function set($key, $value) { * @param string $key * @return mixed */ - public function get($key) { + public function get(string $key): mixed { if (!$this->exists($key)) { return null; } diff --git a/lib/private/Session/Session.php b/lib/private/Session/Session.php index 8875dbb27077..fd1ef1397618 100644 --- a/lib/private/Session/Session.php +++ b/lib/private/Session/Session.php @@ -23,19 +23,17 @@ namespace OC\Session; +use ArrayAccess; use OCP\ISession; -abstract class Session implements \ArrayAccess, ISession { - /** - * @var bool - */ - protected $sessionClosed = false; +abstract class Session implements ArrayAccess, ISession { + protected bool $sessionClosed = false; /** * @param mixed $offset * @return bool */ - public function offsetExists($offset) { + public function offsetExists(mixed $offset): bool { return $this->exists($offset); } @@ -43,7 +41,7 @@ public function offsetExists($offset) { * @param mixed $offset * @return mixed */ - public function offsetGet($offset) { + public function offsetGet(mixed $offset): mixed { return $this->get($offset); } @@ -51,21 +49,21 @@ public function offsetGet($offset) { * @param mixed $offset * @param mixed $value */ - public function offsetSet($offset, $value) { + public function offsetSet(mixed $offset, mixed $value): void { $this->set($offset, $value); } /** * @param mixed $offset */ - public function offsetUnset($offset) { + public function offsetUnset(mixed $offset): void { $this->remove($offset); } /** * Close the session and release the lock */ - public function close() { + public function close(): void { $this->sessionClosed = true; } } diff --git a/lib/private/Setup.php b/lib/private/Setup.php index 616912ea3ddb..2b5157607703 100644 --- a/lib/private/Setup.php +++ b/lib/private/Setup.php @@ -92,19 +92,21 @@ public function __construct( /** * Wrapper around the "class_exists" PHP function to be able to mock it + * * @param string $name * @return bool */ - protected function IsClassExisting($name) { + protected function IsClassExisting(string $name): bool { return \class_exists($name); } /** * Wrapper around the "is_callable" PHP function to be able to mock it + * * @param string $name * @return bool */ - protected function is_callable($name) { + protected function is_callable(string $name): bool { return \is_callable($name); } @@ -113,7 +115,7 @@ protected function is_callable($name) { * * @return array */ - protected function getAvailableDbDriversForPdo() { + protected function getAvailableDbDriversForPdo(): array { return \PDO::getAvailableDrivers(); } @@ -124,7 +126,7 @@ protected function getAvailableDbDriversForPdo() { * @return array * @throws Exception */ - public function getSupportedDatabases($allowAllDatabases = false) { + public function getSupportedDatabases(bool $allowAllDatabases = false): array { $availableDatabases = [ 'sqlite' => [ 'type' => 'class', @@ -190,7 +192,7 @@ public function getSupportedDatabases($allowAllDatabases = false) { * @return array of system info, including an "errors" value * in case of errors/warnings */ - public function getSystemInfo($allowAllDatabases = false) { + public function getSystemInfo(bool $allowAllDatabases = false): array { $databases = $this->getSupportedDatabases($allowAllDatabases); $dataDir = $this->config->getSystemValue('datadirectory', \OC::$SERVERROOT.'/data'); @@ -205,7 +207,7 @@ public function getSystemInfo($allowAllDatabases = false) { } if (\is_dir($dataDir) && \is_writable($dataDir)) { // Protect data directory here, so we can test if the protection is working - \OC\Setup::protectDataDirectory(); + self::protectDataDirectory(); } if (!\OC_Util::runningOn('linux')) { @@ -247,11 +249,7 @@ public function getSystemInfo($allowAllDatabases = false) { ]; } - /** - * @param $options - * @return array - */ - public function install($options) { + public function install(array $options): array { $l = $this->l10n; $error = []; @@ -288,7 +286,7 @@ public function install($options) { // validate the data directory if ( - (!\is_dir($dataDir) and !\mkdir($dataDir)) or + (!\is_dir($dataDir) && !\mkdir($dataDir)) || !\is_writable($dataDir) ) { $error[] = $l->t("Can't create or write into the data directory %s", [$dataDir]); @@ -302,7 +300,7 @@ public function install($options) { // validate the apps-external directory if ( - (!\is_dir($appsExternalDir) and !\mkdir($appsExternalDir)) or + (!\is_dir($appsExternalDir) && !\mkdir($appsExternalDir)) || !\is_writable($appsExternalDir) ) { $htmlAppsExternalDir = \htmlspecialchars_decode($appsExternalDir); @@ -324,7 +322,7 @@ public function install($options) { } //use sqlite3 when available, otherwise sqlite2 will be used. - if ($dbType=='sqlite' and $this->IsClassExisting('SQLite3')) { + if ($dbType === 'sqlite' && $this->IsClassExisting('SQLite3')) { $dbType='sqlite3'; } @@ -399,9 +397,9 @@ public function install($options) { && \is_writable(self::pathToHtaccess()) ) { // Update .htaccess files - Setup::updateHtaccess(); + self::updateHtaccess(); } - Setup::protectDataDirectory(); + self::protectDataDirectory(); //try to write logtimezone if (\date_default_timezone_get()) { @@ -445,21 +443,21 @@ public function install($options) { return $error; } - public static function installBackgroundJobs() { + public static function installBackgroundJobs(): void { \OC::$server->getJobList()->add('\OC\Authentication\Token\DefaultTokenCleanupJob'); } /** * @return string Absolute path to htaccess */ - public static function pathToHtaccess() { + public static function pathToHtaccess(): string { return \OC::$SERVERROOT.'/.htaccess'; } /** * Append the correct ErrorDocument path for Apache hosts */ - public static function updateHtaccess() { + public static function updateHtaccess(): void { $config = \OC::$server->getConfig(); $il10n = \OC::$server->getL10N('lib'); @@ -470,7 +468,11 @@ public static function updateHtaccess() { return; } $webRoot = \parse_url($webRoot, PHP_URL_PATH); - $webRoot = \rtrim($webRoot, '/'); + if (\is_string($webRoot)) { + $webRoot = \rtrim($webRoot, '/'); + } else { + $webRoot = ''; + } } else { $webRoot = !empty(\OC::$WEBROOT) ? \OC::$WEBROOT : '/'; } @@ -543,7 +545,7 @@ public static function updateHtaccess() { } } - public static function protectDataDirectory() { + public static function protectDataDirectory(): void { //Require all denied $now = \date('Y-m-d H:i:s'); $content = "# Generated by ownCloud on $now\n"; diff --git a/lib/private/Setup/MySQL.php b/lib/private/Setup/MySQL.php index 0cb4ce11fd45..ddcef24c03e5 100644 --- a/lib/private/Setup/MySQL.php +++ b/lib/private/Setup/MySQL.php @@ -54,7 +54,8 @@ public function setupDatabase($username) { $query='select count(*) from information_schema.tables where table_schema=? AND table_name = ?'; $result = $connection->executeQuery($query, [$this->dbName, $this->tablePrefix.'users']); $row = $result->fetchAssociative(); - if (!$row or $row['count(*)'] === '0') { + $result->free(); + if (!$row || $row['count(*)'] === 0) { (new \OC\DB\MDB2SchemaManager(\OC::$server->getDatabaseConnection()))->createDbFromStructure($this->dbDefinitionFile); } } @@ -69,7 +70,7 @@ private function createDatabase($connection) { //we can't use OC_DB functions here because we need to connect as the administrative user. $characterSet = $this->config->getSystemValue('mysql.utf8mb4', false) ? 'utf8mb4' : 'utf8'; $query = "CREATE DATABASE IF NOT EXISTS `$name` CHARACTER SET $characterSet COLLATE {$characterSet}_bin;"; - $connection->executeUpdate($query); + $connection->executeStatement($query); } catch (\Exception $ex) { $this->logger->error('Database creation failed: {error}', [ 'app' => 'mysql.setup', @@ -81,7 +82,7 @@ private function createDatabase($connection) { try { //this query will fail if there aren't the right permissions, ignore the error $query="GRANT ALL PRIVILEGES ON `$name` . * TO '$user'"; - $connection->executeUpdate($query); + $connection->executeStatement($query); } catch (\Exception $ex) { $this->logger->debug('Could not automatically grant privileges, this can be ignored if database user already had privileges: {error}', [ 'app' => 'mysql.setup', @@ -100,9 +101,9 @@ private function createDBUser($connection) { // we need to create 2 accounts, one for global use and one for local user. if we don't specify the local one, // the anonymous user would take precedence when there is one. $query = "CREATE USER '$name'@'localhost' IDENTIFIED BY '$password'"; - $connection->executeUpdate($query); + $connection->executeStatement($query); $query = "CREATE USER '$name'@'%' IDENTIFIED BY '$password'"; - $connection->executeUpdate($query); + $connection->executeStatement($query); } /** diff --git a/lib/private/Share20/DefaultShareProvider.php b/lib/private/Share20/DefaultShareProvider.php index 1b86f3024683..8e07d99d4000 100644 --- a/lib/private/Share20/DefaultShareProvider.php +++ b/lib/private/Share20/DefaultShareProvider.php @@ -552,7 +552,7 @@ public function getSharesBy($userId, $shareType, $node, $reshares, $limit, $offs * @inheritdoc */ public function getShareById($id, $recipientId = null) { - if (!ctype_digit($id)) { + if (!ctype_digit((string)$id)) { // share id is defined as a field of type integer // if someone calls the API asking for a share id like "abc" // then there is no point trying to query the database, diff --git a/lib/private/Share20/Manager.php b/lib/private/Share20/Manager.php index 22283779bc9b..4918a7259c99 100644 --- a/lib/private/Share20/Manager.php +++ b/lib/private/Share20/Manager.php @@ -1199,7 +1199,7 @@ public function deleteShare(\OCP\Share\IShare $share) { $deletedShares[] = $share; //Format hook info - $formattedDeletedShares = \array_map('self::formatUnshareHookParams', $deletedShares); + $formattedDeletedShares = \array_map(self::formatUnshareHookParams(...), $deletedShares); $hookParams['deletedShares'] = $formattedDeletedShares; diff --git a/lib/private/Template/JSResourceLocator.php b/lib/private/Template/JSResourceLocator.php index d73038c6c4e6..14925f9a4baa 100644 --- a/lib/private/Template/JSResourceLocator.php +++ b/lib/private/Template/JSResourceLocator.php @@ -39,7 +39,7 @@ public function doFind($script) { $webRoot = \substr($this->theme->getWebPath(), 0, -\strlen($themeDirectory)); } - if (\strpos($script, '/l10n/') !== false) { + if (str_contains($script, '/l10n/')) { $app = \substr($fullScript, 0, \strpos($fullScript, '/')); $appFolderLocation = \explode('/', $this->appManager->getAppWebPath($app))[1] ?? 'apps'; diff --git a/lib/private/URLGenerator.php b/lib/private/URLGenerator.php index a6367adea3e0..34abd493fc9e 100644 --- a/lib/private/URLGenerator.php +++ b/lib/private/URLGenerator.php @@ -96,7 +96,7 @@ public function linkToRoute($route, $parameters = []) { * * Returns an absolute url to the given route. */ - public function linkToRouteAbsolute($routeName, $arguments = []) { + public function linkToRouteAbsolute($routeName, $arguments = []): string { return $this->getAbsoluteURL($this->linkToRoute($routeName, $arguments)); } @@ -237,7 +237,7 @@ private function getImagePathOrFallback($file) { * @param string $url the url in the ownCloud host * @return string the absolute version of the url */ - public function getAbsoluteURL($url) { + public function getAbsoluteURL($url): string { $webRoot = $this->environmentHelper->getWebRoot(); $separator = $url[0] === '/' ? '' : '/'; diff --git a/lib/private/Updater/VersionCheck.php b/lib/private/Updater/VersionCheck.php index 9269717c6341..062a196e0f9f 100644 --- a/lib/private/Updater/VersionCheck.php +++ b/lib/private/Updater/VersionCheck.php @@ -78,9 +78,7 @@ public function check() { $tmp = []; $xml = $this->getUrlContent($url); if ($xml) { - $loadEntities = \libxml_disable_entity_loader(true); $data = @\simplexml_load_string($xml); - \libxml_disable_entity_loader($loadEntities); if ($data !== false) { $tmp['version'] = (string)$data->version; $tmp['versionstring'] = (string)$data->versionstring; diff --git a/lib/private/User/Database.php b/lib/private/User/Database.php index 2e413ba37d7e..d5313a53b5a5 100644 --- a/lib/private/User/Database.php +++ b/lib/private/User/Database.php @@ -167,7 +167,7 @@ public function setDisplayName($uid, $displayName) { */ public function getDisplayName($uid) { $this->loadUser($uid); - if (\strlen($this->cache[$uid]['displayname']) === 0) { + if (($this->cache[$uid]['displayname'] ?? '') === '') { return $uid; } diff --git a/lib/private/User/Sync/BackendUsersIterator.php b/lib/private/User/Sync/BackendUsersIterator.php index 25b5d748e523..062374bfaefe 100644 --- a/lib/private/User/Sync/BackendUsersIterator.php +++ b/lib/private/User/Sync/BackendUsersIterator.php @@ -23,33 +23,30 @@ use OCP\UserInterface; class BackendUsersIterator extends UsersIterator { - /** - * @var UserInterface - */ - private $backend; + private UserInterface $backend; /** * @var int the current data position, * we need to track it independently of parent::$position to handle data sets larger thin LIMIT properly */ - private $dataPos = 0; + private int $dataPos = 0; /** * @var int to cache the count($this->data) calculations */ - private $endPos = 0; + private int $endPos = 0; /** @var bool false if the backend returned less than LIMIT results */ - private $hasMoreData = false; + private bool $hasMoreData = false; /** @var string search for the uid string in backend */ - private $search; + private string $search; - public function __construct(UserInterface $backend, $filterUID = '') { + public function __construct(UserInterface $backend, string $filterUID = '') { $this->backend = $backend; $this->search = $filterUID; } - public function rewind() { + public function rewind(): void { parent::rewind(); $this->data = $this->backend->getUsers($this->search, self::LIMIT, 0); $this->dataPos = 0; @@ -57,7 +54,7 @@ public function rewind() { $this->hasMoreData = $this->endPos >= self::LIMIT; } - public function next() { + public function next(): void { $this->position++; $this->dataPos++; if ($this->hasMoreData && $this->dataPos >= $this->endPos) { @@ -70,7 +67,7 @@ public function next() { } } - protected function currentDataPos() { + protected function currentDataPos(): int { return $this->dataPos; } } diff --git a/lib/private/User/Sync/SeenUsersIterator.php b/lib/private/User/Sync/SeenUsersIterator.php index f4af918c0a98..53e331c2c018 100644 --- a/lib/private/User/Sync/SeenUsersIterator.php +++ b/lib/private/User/Sync/SeenUsersIterator.php @@ -23,26 +23,20 @@ use OC\User\AccountMapper; class SeenUsersIterator extends UsersIterator { - /** - * @var AccountMapper - */ - private $mapper; - /** - * @var string class name - */ - private $backend; + private AccountMapper $mapper; + private string $backend; - public function __construct(AccountMapper $mapper, $backend) { + public function __construct(AccountMapper $mapper, string $backend) { $this->mapper = $mapper; $this->backend = $backend; } - public function rewind() { + public function rewind(): void { parent::rewind(); $this->data = $this->mapper->findUserIds($this->backend, true, self::LIMIT, 0); } - public function next() { + public function next(): void { $this->position++; if ($this->currentDataPos() === 0) { $this->page++; diff --git a/lib/private/User/Sync/UsersIterator.php b/lib/private/User/Sync/UsersIterator.php index 9a97aae64abe..486c552b7fb9 100644 --- a/lib/private/User/Sync/UsersIterator.php +++ b/lib/private/User/Sync/UsersIterator.php @@ -21,32 +21,32 @@ namespace OC\User\Sync; abstract class UsersIterator implements \Iterator { - protected $position = 0; + protected int $position = 0; protected $page; protected $data; public const LIMIT = 500; - public function rewind() { + public function rewind(): void { $this->position = 0; $this->page = 0; } - public function current() { + public function current(): mixed { return $this->data[$this->currentDataPos()]; } - public function key() { + public function key(): mixed { return $this->position; } - abstract public function next(); + abstract public function next(): void; - public function valid() { + public function valid(): bool { return isset($this->data[$this->currentDataPos()]); } - protected function currentDataPos() { + protected function currentDataPos(): int { return $this->position % self::LIMIT; } } diff --git a/lib/private/User/User.php b/lib/private/User/User.php index a252016b2dd4..3739570ab5db 100644 --- a/lib/private/User/User.php +++ b/lib/private/User/User.php @@ -191,9 +191,9 @@ public function setUserName($userName) { * * @return string */ - public function getDisplayName() { - $displayName = $this->account->getDisplayName(); - if (\strlen($displayName) === 0) { + public function getDisplayName(): string { + $displayName = $this->account->getDisplayName() ?? ''; + if ($displayName === '') { $displayName = $this->getUID(); } return $displayName; diff --git a/lib/private/legacy/app.php b/lib/private/legacy/app.php index d855d5ba4a8e..ce29c6159cad 100644 --- a/lib/private/legacy/app.php +++ b/lib/private/legacy/app.php @@ -128,7 +128,7 @@ public static function loadApps($types = null) { \ob_end_clean(); // once all authentication apps are loaded we can validate the session - if ($types === null || \in_array('authentication', $types)) { + if ($types === null || \in_array('authentication', \is_array($types) ? $types : [$types], true)) { if (\OC::$server->getUserSession()) { $request = \OC::$server->getRequest(); $session = \OC::$server->getUserSession(); diff --git a/lib/private/legacy/helper.php b/lib/private/legacy/helper.php index fdea49525aee..47b235ca88c8 100644 --- a/lib/private/legacy/helper.php +++ b/lib/private/legacy/helper.php @@ -195,11 +195,12 @@ public static function copyr($src, $dest) { /** * Recursive deletion of folders + * * @param string $dir path to the folder * @param bool $deleteSelf if set to false only the content of the folder will be deleted * @return bool */ - public static function rmdirr($dir, $deleteSelf = true) { + public static function rmdirr(string $dir, bool $deleteSelf = true): bool { if (\is_dir($dir)) { $files = new RecursiveIteratorIterator( new RecursiveDirectoryIterator($dir, RecursiveDirectoryIterator::SKIP_DOTS), @@ -556,7 +557,7 @@ public static function findBinaryPath($program) { * @param string $path * @return string|null */ - public static function getCleanedPath($path = '') { + public static function getCleanedPath(string $path = ''): ?string { $pattern = "((\/[\w\d]*)+)"; if (\preg_match_all($pattern, $path, $matches) > 0) { diff --git a/lib/private/legacy/image.php b/lib/private/legacy/image.php index 8844710a3f56..d08416585972 100644 --- a/lib/private/legacy/image.php +++ b/lib/private/legacy/image.php @@ -42,8 +42,7 @@ * Class for basic image manipulation */ class OC_Image implements \OCP\IImage { - /** @var false|resource */ - protected $resource = false; // tmp resource. + protected ?\GdImage $resource = null; // tmp resource. /** @var int */ protected $imageType = IMAGETYPE_PNG; // Default to png if file type isn't evident. /** @var string */ @@ -107,11 +106,10 @@ public function __construct($imageRef = null, $logger = null, $config = null) { /** * Determine whether the object contains an image resource. - * - * @return bool */ - public function valid() { // apparently you can't name a method 'empty'... - return \is_resource($this->resource); + public function valid(): bool { + // apparently you can't name a method 'empty'... + return $this->resource instanceof \GdImage; } /** @@ -218,7 +216,9 @@ public function save($filePath = null, $mimeType = null) { if ($filePath === null && $this->filePath === null) { $this->logger->error(__METHOD__ . '(): called with no path.', ['app' => 'core']); return false; - } elseif ($filePath === null && $this->filePath !== null) { + } + + if ($filePath === null && $this->filePath !== null) { $filePath = $this->filePath; } return $this->_output($filePath, $mimeType); @@ -240,7 +240,9 @@ private function _output($filePath = null, $mimeType = null) { if (!\is_writable(\dirname($filePath))) { $this->logger->error(__METHOD__ . '(): Directory \'' . \dirname($filePath) . '\' is not writable.', ['app' => 'core']); return false; - } elseif (\is_writable(\dirname($filePath)) && \file_exists($filePath) && !\is_writable($filePath)) { + } + + if (\is_writable(\dirname($filePath)) && \file_exists($filePath) && !\is_writable($filePath)) { $this->logger->error(__METHOD__ . '(): File \'' . $filePath . '\' is not writable.', ['app' => 'core']); return false; } @@ -316,10 +318,7 @@ public function __invoke() { return $this->show(); } - /** - * @return resource Returns the image resource in any. - */ - public function resource() { + public function resource(): ?GdImage { return $this->resource; } @@ -491,18 +490,18 @@ public function fixOrientation() { \imagedestroy($this->resource); $this->resource = $res; return true; - } else { - $this->logger->debug('OC_Image->fixOrientation() Error during alpha-saving', ['app' => 'core']); - return false; } - } else { - $this->logger->debug('OC_Image->fixOrientation() Error during alpha-blending', ['app' => 'core']); + + $this->logger->debug('OC_Image->fixOrientation() Error during alpha-saving', ['app' => 'core']); return false; } - } else { - $this->logger->debug('OC_Image->fixOrientation() Error during orientation fixing', ['app' => 'core']); + + $this->logger->debug('OC_Image->fixOrientation() Error during alpha-blending', ['app' => 'core']); return false; } + + $this->logger->debug('OC_Image->fixOrientation() Error during orientation fixing', ['app' => 'core']); + return false; } return false; } @@ -510,22 +509,27 @@ public function fixOrientation() { /** * Loads an image from a local file, a base64 encoded string or a resource created by an imagecreate* function. * - * @param resource|string $imageRef The path to a local file, a base64 encoded string or a resource created by an imagecreate* function or a file resource (file handle ). - * @return resource|false An image resource or false on error + * @param GdImage|resource|string $imageRef The path to a local file, a base64 encoded string or a resource created by an imagecreate* function or a file resource (file handle ). + * @return GdImage|false An image resource or false on error */ public function load($imageRef) { + if ($imageRef instanceof \GdImage) { + $this->resource = $imageRef; + return $this->resource; + } if (\is_resource($imageRef)) { - if (\get_resource_type($imageRef) == 'gd') { - $this->resource = $imageRef; - return $this->resource; - } elseif (\in_array(\get_resource_type($imageRef), ['file', 'stream'])) { - return $this->loadFromFileHandle($imageRef); - } - } elseif ($this->loadFromBase64($imageRef) !== false) { + return $this->loadFromFileHandle($imageRef); + } + + if ($this->loadFromBase64($imageRef) !== false) { return $this->resource; - } elseif ($this->loadFromFile($imageRef) !== false) { + } + + if ($this->loadFromFile($imageRef) !== false) { return $this->resource; - } elseif ($this->loadFromData($imageRef) !== false) { + } + + if ($this->loadFromData($imageRef) !== false) { return $this->resource; } $this->logger->debug(__METHOD__ . '(): could not load anything. Giving up!', ['app' => 'core']); @@ -537,9 +541,9 @@ public function load($imageRef) { * It is the responsibility of the caller to position the pointer at the correct place and to close the handle again. * * @param resource $handle - * @return resource|false An image resource or false on error + * @return GdImage|false|null An image resource or false on error */ - public function loadFromFileHandle($handle) { + public function loadFromFileHandle($handle): GdImage|false|null { $contents = \stream_get_contents($handle); if ($this->loadFromData($contents)) { $this->adjustStreamChunkSize($handle); @@ -667,7 +671,10 @@ public function loadFromFile($imagePath = false) { } break; case IMAGETYPE_BMP: - $this->resource = $this->imagecreatefrombmp($imagePath); + $resource = $this->imagecreatefrombmp($imagePath); + if ($resource !== false) { + $this->resource = $resource; + } break; /* case IMAGETYPE_TIFF_II: // (intel byte order) @@ -714,61 +721,55 @@ public function loadFromFile($imagePath = false) { * Loads an image from a string of data. * * @param string $str A string of image data as read from a file. - * @return bool|resource An image resource or false on error + * @return bool An image resource or false on error */ public function loadFromData($str) { - if (\is_resource($str)) { + if (!\is_string($str)) { return false; } - $this->resource = @\imagecreatefromstring($str); + $resource = @\imagecreatefromstring($str); if ($this->fileInfo) { $this->mimeType = $this->fileInfo->buffer($str); } - if (\is_resource($this->resource)) { - \imagealphablending($this->resource, false); - \imagesavealpha($this->resource, true); - } - - if (!$this->resource) { + if (!$resource) { $this->logger->debug('OC_Image->loadFromFile, could not load', ['app' => 'core']); return false; } - return $this->resource; + $this->resource = $resource; + \imagealphablending($this->resource, false); + \imagesavealpha($this->resource, true); + + return true; } /** * Loads an image from a base64 encoded string. * * @param string $str A string base64 encoded string of image data. - * @return bool|resource An image resource or false on error + * @return bool An image resource or false on error */ - public function loadFromBase64($str) { + public function loadFromBase64(string $str): bool { if (!\is_string($str)) { return false; } $data = \base64_decode($str); if ($data) { // try to load from string data - $this->resource = @\imagecreatefromstring($data); + $resource = @\imagecreatefromstring($data); if ($this->fileInfo) { $this->mimeType = $this->fileInfo->buffer($data); } - if (!$this->resource) { + if ($resource === false) { $this->logger->debug('OC_Image->loadFromBase64, could not load', ['app' => 'core']); return false; } - return $this->resource; - } else { - return false; + $this->resource = $resource; + return true; } + + return false; } - /** - * Create a new image from file or URL - * @param string $fileName

- * Path to the BMP image. - * @return bool|resource an image resource identifier on success, FALSE on errors. - */ - private function imagecreatefrombmp($fileName) { + private function imagecreatefrombmp(string $fileName): GdImage|bool { try { $bmp = new BmpToResource($fileName); $imageHandle = $bmp->toResource(); @@ -823,9 +824,8 @@ public function preciseResize($width, $height) { $heightOrig = \imagesy($this->resource); $process = \imagecreatetruecolor($width, $height); - if ($process == false) { + if ($process === false) { $this->logger->error(__METHOD__ . '(): Error creating true color image', ['app' => 'core']); - \imagedestroy($process); return false; } @@ -836,8 +836,8 @@ public function preciseResize($width, $height) { \imagesavealpha($process, true); } - \imagecopyresampled($process, $this->resource, 0, 0, 0, 0, $width, $height, $widthOrig, $heightOrig); - if ($process == false) { + $result = \imagecopyresampled($process, $this->resource, 0, 0, 0, 0, $width, $height, $widthOrig, $heightOrig); + if ($result === false) { $this->logger->error(__METHOD__ . '(): Error re-sampling process image', ['app' => 'core']); \imagedestroy($process); return false; @@ -883,7 +883,6 @@ public function centerCrop($size = 0) { $process = \imagecreatetruecolor($targetWidth, $targetHeight); if ($process == false) { $this->logger->error('OC_Image->centerCrop, Error creating true color image', ['app' => 'core']); - \imagedestroy($process); return false; } @@ -894,8 +893,8 @@ public function centerCrop($size = 0) { \imagesavealpha($process, true); } - \imagecopyresampled($process, $this->resource, 0, 0, $x, $y, $targetWidth, $targetHeight, $width, $height); - if ($process == false) { + $result = \imagecopyresampled($process, $this->resource, 0, 0, $x, $y, $targetWidth, $targetHeight, $width, $height); + if ($result === false) { $this->logger->error('OC_Image->centerCrop, Error re-sampling process image ' . $width . 'x' . $height, ['app' => 'core']); \imagedestroy($process); return false; @@ -920,9 +919,8 @@ public function crop($x, $y, $w, $h) { return false; } $process = \imagecreatetruecolor($w, $h); - if ($process == false) { + if ($process === false) { $this->logger->error(__METHOD__ . '(): Error creating true color image', ['app' => 'core']); - \imagedestroy($process); return false; } @@ -933,8 +931,8 @@ public function crop($x, $y, $w, $h) { \imagesavealpha($process, true); } - \imagecopyresampled($process, $this->resource, 0, 0, $x, $y, $w, $h, $w, $h); - if ($process == false) { + $result = \imagecopyresampled($process, $this->resource, 0, 0, $x, $y, $w, $h, $w, $h); + if ($result === false) { $this->logger->error(__METHOD__ . '(): Error re-sampling process image ' . $w . 'x' . $h, ['app' => 'core']); \imagedestroy($process); return false; @@ -994,7 +992,7 @@ public function scaleDownToFit($maxWidth, $maxHeight) { /** * Destroys the current image and resets the object */ - public function destroy() { + public function destroy(): void { if ($this->valid()) { \imagedestroy($this->resource); } @@ -1015,7 +1013,7 @@ public function __destruct() { * @link http://www.programmierer-forum.de/imagebmp-gute-funktion-gefunden-t143716.htm * @author mgutt * @version 1.00 - * @param resource $im + * @param \GdImage $im * @param string $fileName [optional]

The path to save the file to.

* @param int $bit [optional]

Bit depth, (default is 24).

* @param int $compression [optional] @@ -1069,6 +1067,7 @@ function imagebmp($im, $fileName = '', $bit = 24, $compression = 0) { $index = \imagecolorat($im, $i, $j); if ($index !== $lastIndex || $sameNum > 255) { if ($sameNum != 0) { + /** @phan-suppress-next-line PhanTypeMismatchArgumentInternalReal */ $bmpData .= \chr($sameNum) . \chr($lastIndex); } $lastIndex = $index; diff --git a/lib/private/legacy/l10n/string.php b/lib/private/legacy/l10n/string.php index fbfd94860ded..ee1f58f8279f 100644 --- a/lib/private/legacy/l10n/string.php +++ b/lib/private/legacy/l10n/string.php @@ -1,4 +1,7 @@ * @author Bernhard Posselt @@ -26,25 +29,17 @@ */ class OC_L10N_String implements JsonSerializable { - /** @var \OC\L10N\L10N */ - protected $l10n; + protected L10N $l10n; - /** @var string */ - protected $text; + protected string $text; /** @var array */ - protected $parameters; + protected array $parameters; /** @var integer */ - protected $count; + protected int $count; - /** - * @param \OC\L10N\L10N $l10n - * @param string|string[] $text - * @param array $parameters - * @param int $count - */ - public function __construct($l10n, $text, $parameters, $count = 1) { + public function __construct(L10N $l10n, string $text, array $parameters, int $count = 1) { $this->l10n = $l10n; $this->text = $text; $this->parameters = $parameters; @@ -66,13 +61,14 @@ public function __toString() { // Replace %n first (won't interfere with vsprintf) $text = \str_replace('%n', $this->count, $text); - $text = @\vsprintf($text, $this->parameters); + if (\count($this->parameters) === 0) { + return (string)$text; + } - // If vsprintf fails, return untranslated string - return $text === false ? $this->text : $text; + return \vsprintf($text, $this->parameters); } - public function jsonSerialize() { + public function jsonSerialize(): string { return $this->__toString(); } } diff --git a/lib/public/AppFramework/Controller.php b/lib/public/AppFramework/Controller.php index d69f4f5c1d5b..def3a5803c4a 100644 --- a/lib/public/AppFramework/Controller.php +++ b/lib/public/AppFramework/Controller.php @@ -100,11 +100,12 @@ public function __construct( /** * Parses an HTTP accept header and returns the supported responder type + * * @param string $acceptHeader * @return string the responder type * @since 7.0.0 */ - public function getResponderByHTTPHeader($acceptHeader) { + public function getResponderByHTTPHeader(string $acceptHeader): string { $headers = \explode(',', $acceptHeader); // return the first matching responder diff --git a/lib/public/Files/External/Auth/AuthMechanism.php b/lib/public/Files/External/Auth/AuthMechanism.php index b637b9b8de0a..00c6592e562d 100644 --- a/lib/public/Files/External/Auth/AuthMechanism.php +++ b/lib/public/Files/External/Auth/AuthMechanism.php @@ -96,7 +96,7 @@ public function setScheme($scheme) { * @return array * @since 10.0 */ - public function jsonSerialize() { + public function jsonSerialize(): array { $data = $this->jsonSerializeDefinition(); $data += $this->jsonSerializeIdentifier(); diff --git a/lib/public/Files/External/Backend/Backend.php b/lib/public/Files/External/Backend/Backend.php index e11856d65cc6..4288bb60fe0f 100644 --- a/lib/public/Files/External/Backend/Backend.php +++ b/lib/public/Files/External/Backend/Backend.php @@ -118,7 +118,7 @@ public function addAuthScheme($scheme) { * @return array * @since 10.0 */ - public function jsonSerialize() { + public function jsonSerialize(): array { $data = $this->jsonSerializeDefinition(); $data += $this->jsonSerializeIdentifier(); diff --git a/lib/public/Files/External/DefinitionParameter.php b/lib/public/Files/External/DefinitionParameter.php index ed00e2c1d9c9..7ccf7ae8fbd2 100644 --- a/lib/public/Files/External/DefinitionParameter.php +++ b/lib/public/Files/External/DefinitionParameter.php @@ -157,10 +157,9 @@ public function isFlagSet($flag) { /** * Serialize into JSON for client-side JS * - * @return string * @since 10.0 */ - public function jsonSerialize() { + public function jsonSerialize(): array { return [ 'value' => $this->getText(), 'flags' => $this->getFlags(), diff --git a/lib/public/Files/External/IStorageConfig.php b/lib/public/Files/External/IStorageConfig.php index 8405968f726d..e04c9b29ace5 100644 --- a/lib/public/Files/External/IStorageConfig.php +++ b/lib/public/Files/External/IStorageConfig.php @@ -248,5 +248,5 @@ public function setType($type); * @return array * @since 10.0 */ - public function jsonSerialize(); + public function jsonSerialize(): array; } diff --git a/lib/public/IDBConnection.php b/lib/public/IDBConnection.php index c5fe1c32f5a6..6b24df991d56 100644 --- a/lib/public/IDBConnection.php +++ b/lib/public/IDBConnection.php @@ -299,7 +299,7 @@ public function tableExists($table); * @return string * @since 9.0.0 */ - public function escapeLikeParameter($param); + public function escapeLikeParameter(string $param): string; /** * Create the schema of the connected database diff --git a/lib/public/IL10N.php b/lib/public/IL10N.php index 933ce1f75d7a..a8cc30f5a23c 100644 --- a/lib/public/IL10N.php +++ b/lib/public/IL10N.php @@ -44,15 +44,16 @@ interface IL10N { /** * Translating + * * @param string $text The text we need a translation for - * @param array $parameters default:array() Parameters for sprintf - * @return \OC_L10N_String Translation or the same text + * @param array|mixed $parameters default:array() Parameters for sprintf + * @return string Translation or the same text * * Returns the translation. If no translation is found, $text will be * returned. * @since 6.0.0 */ - public function t($text, $parameters = []); + public function t(string $text, $parameters = []): string; /** * Translating diff --git a/lib/public/IRequest.php b/lib/public/IRequest.php index 31987599591e..27b28a297a49 100644 --- a/lib/public/IRequest.php +++ b/lib/public/IRequest.php @@ -80,11 +80,11 @@ public function getHeader(string $name): ?string; * 1. URL parameters * 2. POST parameters * 3. GET parameters - * @param mixed $default If the key is not found, this value will be returned + * @param mixed|null $default If the key is not found, this value will be returned * @return mixed the content of the array * @since 6.0.0 */ - public function getParam($key, $default = null); + public function getParam(string $key, mixed $default = null): mixed; /** * Returns all params that were received, be it from the request @@ -94,7 +94,7 @@ public function getParam($key, $default = null); * @return array the array with all parameters * @since 6.0.0 */ - public function getParams(); + public function getParams(): array; /** * Returns the method of the request @@ -102,7 +102,7 @@ public function getParams(); * @return string the method of the request (POST, GET, etc) * @since 6.0.0 */ - public function getMethod(); + public function getMethod(): string; /** * Shortcut for accessing an uploaded file through the $_FILES array diff --git a/lib/public/ISession.php b/lib/public/ISession.php index 66f477c9fd1a..2f732f67cafa 100644 --- a/lib/public/ISession.php +++ b/lib/public/ISession.php @@ -58,7 +58,7 @@ public function set($key, $value); * @return mixed should return null if $key does not exist * @since 6.0.0 */ - public function get($key); + public function get(string $key): mixed; /** * Check if a named key exists in the session diff --git a/lib/public/IURLGenerator.php b/lib/public/IURLGenerator.php index 481e5f60d1e2..76798c5aff6b 100644 --- a/lib/public/IURLGenerator.php +++ b/lib/public/IURLGenerator.php @@ -53,7 +53,7 @@ public function linkToRoute($routeName, $arguments = []); * @return string the absolute url * @since 8.0.0 */ - public function linkToRouteAbsolute($routeName, $arguments = []); + public function linkToRouteAbsolute($routeName, $arguments = []): string; /** * Returns an URL for an image or file diff --git a/lib/public/Lock/LockedException.php b/lib/public/Lock/LockedException.php index 87d7c1970f2b..fd1667e91c6b 100644 --- a/lib/public/Lock/LockedException.php +++ b/lib/public/Lock/LockedException.php @@ -46,7 +46,7 @@ class LockedException extends \Exception { * @since 8.1.0 */ public function __construct($path, \Exception $previous = null) { - $message = \OC::$server->getL10N('lib')->t('"%s" is locked', $path); + $message = \OC::$server->getL10N('lib')->t('"%s" is locked', [$path]); parent::__construct($message, 0, $previous); $this->path = $path; } diff --git a/lib/public/Mail/IMailer.php b/lib/public/Mail/IMailer.php index 333e961d071c..070dc42737ea 100644 --- a/lib/public/Mail/IMailer.php +++ b/lib/public/Mail/IMailer.php @@ -51,7 +51,7 @@ interface IMailer { * @return Message * @since 8.1.0 */ - public function createMessage(); + public function createMessage(): Message; /** * Send the specified message. Also sets the from address to the value defined in config.php @@ -64,7 +64,7 @@ public function createMessage(); * has been supplied.) * @since 8.1.0 */ - public function send(Message $message); + public function send(Message $message): array; /** * Checks if an e-mail address is valid @@ -73,5 +73,5 @@ public function send(Message $message); * @return bool True if the mail address is valid, false otherwise * @since 8.1.0 */ - public function validateMailAddress($email); + public function validateMailAddress(string $email): bool; } diff --git a/lib/public/Security/ICrypto.php b/lib/public/Security/ICrypto.php index 4a905dc292b5..405c9e349d45 100644 --- a/lib/public/Security/ICrypto.php +++ b/lib/public/Security/ICrypto.php @@ -53,11 +53,12 @@ public function encrypt($plaintext, $password = ''); /** * Decrypts a value and verifies the HMAC (Encrypt-Then-Mac) + * * @param string $authenticatedCiphertext * @param string $password Password to encrypt, if not specified the secret from config.php will be taken * @return string plaintext * @throws \Exception If the HMAC does not match * @since 8.0.0 */ - public function decrypt($authenticatedCiphertext, $password = ''); + public function decrypt(string $authenticatedCiphertext, string $password = ''): string; } diff --git a/settings/ChangePassword/Controller.php b/settings/ChangePassword/Controller.php index 487777b718c3..ea367c476e72 100644 --- a/settings/ChangePassword/Controller.php +++ b/settings/ChangePassword/Controller.php @@ -213,7 +213,7 @@ private static function sendNotificationMail($username) { $mailer->send($message); } catch (\Exception $e) { throw new \Exception($l10n->t( - 'Couldn\'t send reset email. Please contact your administrator.' + "Couldn't send reset email. Please contact your administrator." )); } } diff --git a/settings/Controller/MailSettingsController.php b/settings/Controller/MailSettingsController.php index 9e6e3287e1d4..9f89b3e311d2 100644 --- a/settings/Controller/MailSettingsController.php +++ b/settings/Controller/MailSettingsController.php @@ -85,7 +85,6 @@ public function __construct( * @param string $mail_smtpmode * @param string $mail_smtpsecure * @param string $mail_smtphost - * @param string $mail_smtpauthtype * @param int $mail_smtpauth * @param string $mail_smtpport * @return array @@ -96,7 +95,6 @@ public function setMailSettings( $mail_smtpmode, $mail_smtpsecure, $mail_smtphost, - $mail_smtpauthtype, $mail_smtpauth, $mail_smtpport ) { @@ -162,36 +160,35 @@ public function sendTestMail() { $email = $this->userSession->getUser()->getEMailAddress(); } - if (!empty($email)) { - try { - $message = $this->mailer->createMessage(); - $message->setTo([$email => $this->userSession->getUser()->getDisplayName()]); - $message->setFrom([$this->defaultMailAddress]); - $message->setSubject($this->l10n->t('test email settings')); - $message->setPlainBody('If you received this email, the settings seem to be correct.'); - $this->mailer->send($message); - } catch (\Exception $e) { - return [ - 'data' => [ - 'message' => (string) $this->l10n->t('A problem occurred while sending the email. Please revise your settings. (Error: %s)', [$e->getMessage()]), - ], - 'status' => 'error', - ]; - } + if (empty($email)) { + return ['data' => + ['message' => + (string) $this->l10n->t('You need to set your user email before being able to send test emails.'), + ], + 'status' => 'error' + ]; + } + try { + $message = $this->mailer->createMessage(); + $message->setTo([$email => $this->userSession->getUser()->getDisplayName()]); + $message->setFrom([$this->defaultMailAddress]); + $message->setSubject($this->l10n->t('test email settings')); + $message->setPlainBody('If you received this email, the settings seem to be correct.'); + $this->mailer->send($message); return ['data' => ['message' => (string) $this->l10n->t('Email sent') ], 'status' => 'success' ]; + } catch (\Exception $e) { + return [ + 'data' => [ + 'message' => (string) $this->l10n->t('A problem occurred while sending the email. Please revise your settings. (Error: %s)', [$e->getMessage()]), + ], + 'status' => 'error', + ]; } - - return ['data' => - ['message' => - (string) $this->l10n->t('You need to set your user email before being able to send test emails.'), - ], - 'status' => 'error' - ]; } } diff --git a/settings/Controller/UsersController.php b/settings/Controller/UsersController.php index 76cfca776cf4..955c9e5ec07e 100644 --- a/settings/Controller/UsersController.php +++ b/settings/Controller/UsersController.php @@ -268,7 +268,7 @@ private function checkEmailChangeToken($token, $userId) { throw new \Exception($this->l10n->t('Couldn\'t change the email address because the user does not exist')); } - $splittedToken = \explode(':', $this->config->getUserValue($userId, 'owncloud', 'changeMail', null)); + $splittedToken = \explode(':', $this->config->getUserValue($userId, 'owncloud', 'changeMail', null) ?? ''); if (\count($splittedToken) !== 3) { $this->config->deleteUserValue($userId, 'owncloud', 'changeMail'); throw new \Exception($this->l10n->t('Couldn\'t change the email address because the token is invalid')); diff --git a/settings/Panels/Admin/Mail.php b/settings/Panels/Admin/Mail.php index 4a86cb8b34fc..0c75b63a9f61 100644 --- a/settings/Panels/Admin/Mail.php +++ b/settings/Panels/Admin/Mail.php @@ -61,7 +61,6 @@ public function getPanel() { $template->assign('mail_smtpsecure', $this->config->getSystemValue("mail_smtpsecure", '')); $template->assign('mail_smtphost', $this->config->getSystemValue("mail_smtphost", '')); $template->assign('mail_smtpport', $this->config->getSystemValue("mail_smtpport", '')); - $template->assign('mail_smtpauthtype', $this->config->getSystemValue("mail_smtpauthtype", '')); $template->assign('mail_smtpauth', $this->config->getSystemValue("mail_smtpauth", false)); $template->assign('mail_smtpname', $this->config->getSystemValue("mail_smtpname", '')); $template->assign('mail_user_email', $this->userSession->getUser()->getEMailAddress()); diff --git a/settings/Panels/Admin/SecurityWarning.php b/settings/Panels/Admin/SecurityWarning.php index 9eb7f76c9ef9..6cc43cc00029 100644 --- a/settings/Panels/Admin/SecurityWarning.php +++ b/settings/Panels/Admin/SecurityWarning.php @@ -96,7 +96,7 @@ public function getPanel() { } $template->assign('OutdatedCacheWarning', $outdatedCaches); $template->assign('has_fileinfo', $this->helper->fileInfoLoaded()); - $databaseOverload = (\strpos($this->config->getSystemValue('dbtype'), 'sqlite') !== false); + $databaseOverload = (\strpos($this->config->getSystemValue('dbtype') ?? '', 'sqlite') !== false); $template->assign('databaseOverload', $databaseOverload); if ($this->lockingProvider instanceof NoopLockingProvider) { $template->assign('fileLockingType', 'none'); diff --git a/settings/templates/panels/admin/mail.php b/settings/templates/panels/admin/mail.php index 8604fb4d9a25..45394de5ffc9 100644 --- a/settings/templates/panels/admin/mail.php +++ b/settings/templates/panels/admin/mail.php @@ -1,15 +1,8 @@ $l->t('None'), - 'LOGIN' => $l->t('Login'), - 'PLAIN' => $l->t('Plain'), - 'NTLM' => $l->t('NT LAN Manager'), -]; $mail_smtpsecure = [ '' => $l->t('None'), 'ssl' => $l->t('SSL/TLS'), - 'tls' => $l->t('STARTTLS'), ]; $mail_smtpmode = [ 'php', @@ -80,17 +73,6 @@