Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: ['7.3', '7.4', '8.0']
php-versions: ['7.3', '7.4', '8.0', '8.1']
name: php${{ matrix.php-versions }} lint
steps:
- name: Checkout
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/oci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php-versions: [ '7.3', '7.4', '8.0' ]
php-versions: [ '7.3', '7.4', '8.0', '8.1']
databases: [ 'oci' ]

name: php${{ matrix.php-versions }}-${{ matrix.databases }}
Expand Down
5 changes: 1 addition & 4 deletions apps/encryption/lib/Command/FixEncryptedVersion.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$user = (string)$input->getArgument('user');
$pathToWalk = "/$user/files";

/**
* trim() returns an empty string when the argument is an unset/null
*/
$pathOption = \trim($input->getOption('path'), '/');
$pathOption = \trim(($input->getOption('path') ?? ''), '/');
if ($pathOption !== "") {
$pathToWalk = "$pathToWalk/$pathOption";
}
Expand Down
5 changes: 4 additions & 1 deletion apps/encryption/tests/Crypto/EncryptAllTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,12 @@ protected function setUp(): void {
$this->userInterface = $this->getMockBuilder(UserInterface::class)
->disableOriginalConstructor()->getMock();

/* We need format method to return a string */
$outputFormatter = $this->createMock(OutputFormatterInterface::class);
$outputFormatter->method('format')->willReturnArgument(0);

$this->outputInterface->expects($this->any())->method('getFormatter')
->willReturn($this->createMock(OutputFormatterInterface::class));
->willReturn($outputFormatter);

$this->userManager->expects($this->any())->method('getBackends')->willReturn([$this->userInterface]);
$this->userInterface->expects($this->any())->method('getUsers')->willReturn(['user1', 'user2']);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ public function testPreviewFile() {
->willReturn($file);

$preview = $this->createMock(ISimpleFile::class);
$preview->method('getName')->willReturn('name');
$preview->method('getMTime')->willReturn(42);
$this->previewManager->method('getPreview')
->with($this->equalTo($file), 10, 10, false)
->willReturn($preview);
Expand Down Expand Up @@ -192,6 +194,8 @@ public function testPreviewFolderValidFile() {
->willReturn($file);

$preview = $this->createMock(ISimpleFile::class);
$preview->method('getName')->willReturn('name');
$preview->method('getMTime')->willReturn(42);
$this->previewManager->method('getPreview')
->with($this->equalTo($file), 10, 10, false)
->willReturn($preview);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ public function testValidPreview() {
->willReturn($file);

$preview = $this->createMock(ISimpleFile::class);
$preview->method('getName')->willReturn('name');
$preview->method('getMTime')->willReturn(42);
$this->previewManager->method('getPreview')
->with($this->equalTo($file), 10, 10, true, IPreview::MODE_FILL, 'myMime')
->willReturn($preview);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ public function testValidPreview() {
->willReturn($file);

$preview = $this->createMock(ISimpleFile::class);
$preview->method('getName')->willReturn('name');
$preview->method('getMTime')->willReturn(42);
$this->previewManager->method('getPreview')
->with($this->equalTo($file), 10, 10, true, IPreview::MODE_FILL, 'myMime')
->willReturn($preview);
Expand Down
2 changes: 2 additions & 0 deletions apps/settings/tests/Settings/Admin/SharingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ public function testGetFormWithoutExcludedGroups(): void {
->method('getAppValue')
->willReturnMap([
['core', 'shareapi_exclude_groups_list', '', ''],
['core', 'shareapi_allow_links_exclude_groups', '', ''],
['core', 'shareapi_allow_group_sharing', 'yes', 'yes'],
['core', 'shareapi_allow_links', 'yes', 'yes'],
['core', 'shareapi_allow_public_upload', 'yes', 'yes'],
Expand Down Expand Up @@ -146,6 +147,7 @@ public function testGetFormWithExcludedGroups(): void {
->method('getAppValue')
->willReturnMap([
['core', 'shareapi_exclude_groups_list', '', '["NoSharers","OtherNoSharers"]'],
['core', 'shareapi_allow_links_exclude_groups', '', ''],
['core', 'shareapi_allow_group_sharing', 'yes', 'yes'],
['core', 'shareapi_allow_links', 'yes', 'yes'],
['core', 'shareapi_allow_public_upload', 'yes', 'yes'],
Expand Down
2 changes: 2 additions & 0 deletions apps/theming/tests/Controller/IconControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ private function iconFileMock($filename, $data) {
$icon->expects($this->any())->method('getContent')->willReturn($data);
$icon->expects($this->any())->method('getMimeType')->willReturn('image type');
$icon->expects($this->any())->method('getEtag')->willReturn('my etag');
$icon->expects($this->any())->method('getName')->willReturn('my name');
$icon->expects($this->any())->method('getMTime')->willReturn(42);
$icon->method('getName')->willReturn($filename);
return new SimpleFile($icon);
}
Expand Down
7 changes: 7 additions & 0 deletions apps/theming/tests/Controller/ThemingControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -689,6 +689,8 @@ public function testGetLogoNotExistent() {

public function testGetLogo() {
$file = $this->createMock(ISimpleFile::class);
$file->method('getName')->willReturn('logo.svg');
$file->method('getMTime')->willReturn(42);
$this->imageManager->expects($this->once())
->method('getImage')
->willReturn($file);
Expand Down Expand Up @@ -719,6 +721,8 @@ public function testGetLoginBackgroundNotExistent() {

public function testGetLoginBackground() {
$file = $this->createMock(ISimpleFile::class);
$file->method('getName')->willReturn('background.png');
$file->method('getMTime')->willReturn(42);
$this->imageManager->expects($this->once())
->method('getImage')
->willReturn($file);
Expand All @@ -744,6 +748,7 @@ public function testGetStylesheet() {
$this->appManager->expects($this->once())->method('getAppPath')->with('theming')->willReturn(\OC::$SERVERROOT . '/theming');
$file = $this->createMock(ISimpleFile::class);
$file->expects($this->any())->method('getName')->willReturn('theming.css');
$file->expects($this->any())->method('getMTime')->willReturn(42);
$file->expects($this->any())->method('getContent')->willReturn('compiled');
$this->scssCacher->expects($this->once())->method('process')->willReturn(true);
$this->scssCacher->expects($this->once())->method('getCachedCSS')->willReturn($file);
Expand All @@ -759,6 +764,7 @@ public function testGetStylesheetFails() {
$this->appManager->expects($this->once())->method('getAppPath')->with('theming')->willReturn(\OC::$SERVERROOT . '/theming');
$file = $this->createMock(ISimpleFile::class);
$file->expects($this->any())->method('getName')->willReturn('theming.css');
$file->expects($this->any())->method('getMTime')->willReturn(42);
$file->expects($this->any())->method('getContent')->willReturn('compiled');
$this->scssCacher->expects($this->once())->method('process')->willReturn(true);
$this->scssCacher->expects($this->once())->method('getCachedCSS')->willThrowException(new NotFoundException());
Expand All @@ -772,6 +778,7 @@ public function testGetStylesheetOutsideServerroot() {
$this->appManager->expects($this->once())->method('getAppPath')->with('theming')->willReturn('/outside/serverroot/theming');
$file = $this->createMock(ISimpleFile::class);
$file->expects($this->any())->method('getName')->willReturn('theming.css');
$file->expects($this->any())->method('getMTime')->willReturn(42);
$file->expects($this->any())->method('getContent')->willReturn('compiled');
$this->scssCacher->expects($this->once())->method('process')->with('/outside/serverroot/theming', 'css/theming.scss', 'theming')->willReturn(true);
$this->scssCacher->expects($this->once())->method('getCachedCSS')->willReturn($file);
Expand Down
8 changes: 4 additions & 4 deletions apps/user_ldap/lib/Access.php
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ public function readAttribute($dn, $attr, $filter = 'objectClass=*') {
/**
* Runs an read operation against LDAP
*
* @param resource $cr the LDAP connection
* @param resource|\LDAP\Connection $cr the LDAP connection
* @param string $dn
* @param string $attribute
* @param string $filter
Expand Down Expand Up @@ -926,7 +926,7 @@ public function fetchListOfUsers(string $filter, array $attr, int $limit = null,
* @throws \Exception
*/
public function batchApplyUserAttributes(array $ldapRecords) {
$displayNameAttribute = strtolower($this->connection->ldapUserDisplayName);
$displayNameAttribute = strtolower((string)$this->connection->ldapUserDisplayName);
foreach ($ldapRecords as $userRecord) {
if (!isset($userRecord[$displayNameAttribute])) {
// displayName is obligatory
Expand Down Expand Up @@ -1186,7 +1186,7 @@ private function executeSearch(
/**
* processes an LDAP paged search operation
*
* @param resource $sr the array containing the LDAP search resources
* @param resource|\LDAP\Result|resource[]|\LDAP\Result[] $sr the array containing the LDAP search resources
* @param int $foundItems number of results in the single search operation
* @param int $limit maximum results to be counted
* @param bool $pagedSearchOK whether a paged search has been executed
Expand Down Expand Up @@ -1303,7 +1303,7 @@ private function count(
}

/**
* @param resource $sr
* @param resource|\LDAP\Result|resource[]|\LDAP\Result[] $sr
* @return int
* @throws ServerNotAvailableException
*/
Expand Down
9 changes: 6 additions & 3 deletions apps/user_ldap/lib/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@
* @property string ldapMatchingRuleInChainState
*/
class Connection extends LDAPUtility {
/**
* @var resource|\LDAP\Connection|null
*/
private $ldapConnectionRes = null;
private $configPrefix;
private $configID;
Expand Down Expand Up @@ -202,7 +205,7 @@ public function init($force = false) {
}

/**
* Returns the LDAP handler
* @return resource|\LDAP\Connection The LDAP resource
*/
public function getConnectionResource() {
if (!$this->ldapConnectionRes) {
Expand Down Expand Up @@ -408,7 +411,7 @@ private function doSoftValidation() {
}
}

if ((stripos($this->configuration->ldapHost, 'ldaps://') === 0)
if ((stripos((string)$this->configuration->ldapHost, 'ldaps://') === 0)
&& $this->configuration->ldapTLS) {
$this->configuration->ldapTLS = false;
$this->logger->info(
Expand Down Expand Up @@ -487,7 +490,7 @@ private function doCriticalValidation() {
$configurationOK = false;
}

if (mb_strpos($this->configuration->ldapLoginFilter, '%uid', 0, 'UTF-8')
if (mb_strpos((string)$this->configuration->ldapLoginFilter, '%uid', 0, 'UTF-8')
=== false) {
$this->logger->warning(
$errorStr.'login filter does not contain %uid place holder.',
Expand Down
6 changes: 3 additions & 3 deletions apps/user_ldap/lib/Group_LDAP.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public function __construct(Access $access, GroupPluginManager $groupPluginManag
$this->cachedNestedGroups = new CappedMemoryCache();
$this->groupPluginManager = $groupPluginManager;
$this->logger = OC::$server->get(LoggerInterface::class);
$this->ldapGroupMemberAssocAttr = strtolower($gAssoc);
$this->ldapGroupMemberAssocAttr = strtolower((string)$gAssoc);
}

/**
Expand Down Expand Up @@ -202,7 +202,7 @@ public function inGroup($uid, $gid) {
* @throws ServerNotAvailableException
*/
public function getDynamicGroupMembers(string $dnGroup): array {
$dynamicGroupMemberURL = strtolower($this->access->connection->ldapDynamicGroupMemberURL);
$dynamicGroupMemberURL = strtolower((string)$this->access->connection->ldapDynamicGroupMemberURL);

if (empty($dynamicGroupMemberURL)) {
return [];
Expand Down Expand Up @@ -1312,7 +1312,7 @@ public function getGroupDetails($gid) {
* of the current access.
*
* @param string $gid
* @return resource of the LDAP connection
* @return resource|\LDAP\Connection The LDAP connection
* @throws ServerNotAvailableException
*/
public function getNewLDAPConnection($gid) {
Expand Down
2 changes: 1 addition & 1 deletion apps/user_ldap/lib/Group_Proxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ public function getLDAPAccess($gid) {
* The connection needs to be closed manually.
*
* @param string $gid
* @return resource of the LDAP connection
* @return resource|\LDAP\Connection The LDAP connection
*/
public function getNewLDAPConnection($gid) {
return $this->handleRequest($gid, 'getNewLDAPConnection', [$gid]);
Expand Down
2 changes: 1 addition & 1 deletion apps/user_ldap/lib/IGroupLDAP.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function getLDAPAccess($gid);
/**
* Return a new LDAP connection for the specified group.
* @param string $gid
* @return resource of the LDAP connection
* @return resource|\LDAP\Connection The LDAP connection
*/
public function getNewLDAPConnection($gid);
}
Loading