nextcloud / collectives

Collectives is a Nextcloud App for activist and community projects to organize together.
GNU Affero General Public License v3.0
102 stars 19 forks source link

Fix collectives on current Nextcloud main branch #1535

Closed max-nextcloud closed 1 month ago

max-nextcloud commented 1 month ago

There's been a change in the signature of IStorage: https://github.com/nextcloud/server/commit/f28e74b7a8b3df11ba1f2e4a18492b8158528cdf#diff-f7bada9f6beaa1f713c302710e2b73283f5df5c7100966ba7e9a08b4cb2acef9

This leads to requests failing with:

{
  "reqId": "6D48tHHIvcdaAElQ9yq3",
  "level": 3,
  "time": "2024-10-14T02:04:35+00:00",
  "remoteAddr": "127.0.0.1",
  "user": "bob",
  "app": "PHP",
  "method": "POST",
  "url": "/index.php/login",
  "message": "Declaration of OCA\\Collectives\\ACL\\ACLStorageWrapper::stat($path) must be compatible with OC\\Files\\Storage\\Wrapper\\Wrapper::stat(string $path): array|false at /home/runner/work/collectives/collectives/apps/collectives/lib/ACL/ACLStorageWrapper.php#167",
  "userAgent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Cypress/13.6.4 Chrome/114.0.5735.289 Electron/25.8.4 Safari/537.36",
  "version": "31.0.0.3",
  "data": {
    "app": "PHP"
  }
}
max-nextcloud commented 1 month ago

I attempted to fix this in #1534 - but that fails psalm with:

ERROR: MethodSignatureMismatch - lib/ACL/ACLStorageWrapper.php:167:30
 - Argument 1 of OCA\Collectives\ACL\ACLStorageWrapper::stat has wrong type 'string',
 expecting '' as defined by OCP\Files\Storage\IStorage::stat (see https://psalm.dev/042)
    public function stat(string $path): array|false {
max-nextcloud commented 1 month ago

@provokateurin How would i best handle this? (ideally while keeping collectives compatibility with Nextcloud 28 to 30)

provokateurin commented 1 month ago

Adding the return type is backwards compatible. To keep backwards compatibility with older version you don't add the param types now, but once Nextcloud 31 is the lowest supported version. You are not required to add them to be in line with the interface, as allowing more types by not specifying the type is allowed.

juliusknorr commented 1 month ago

Duplicate of https://github.com/nextcloud/collectives/issues/1518