Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Argument 1 passed to OCA\\GroupFolders\\Versions\\VersionsBackend::getVersionsFolder() must be of the type int, string given, called in /var/www/nextcloud/apps/groupfolders/lib/Versions/VersionsBackend.php on line 154 #267

Closed
mtippmann opened this issue Dec 18, 2018 · 22 comments · Fixed by #324

Comments

@mtippmann
Copy link

mtippmann commented Dec 18, 2018

NC: 15
Groupfolders: 2.0.2

Seeing this in the Logfile from cron (that run's with php7.3 cli) - so it's maybe a PHP7.3 related error.

{
  "reqId": "bbg4JJ8VemzDijAzZ2uh",
  "level": 3,
  "time": "2018-12-18T21:15:05+00:00",
  "remoteAddr": "",
  "user": "--",
  "app": "cron",
  "method": "",
  "url": "--",
  "message": {
    "Exception": "TypeError",
    "Message": "Argument 1 passed to OCA\\GroupFolders\\Versions\\VersionsBackend::getVersionsFolder() must be of the type int, string given, called in /var/www/nextcloud/apps/
groupfolders/lib/Versions/VersionsBackend.php on line 154",
    "Code": 0,
    "Trace": [
      {
        "file": "/var/www/nextcloud/apps/groupfolders/lib/Versions/VersionsBackend.php",
        "line": 154,
        "function": "getVersionsFolder",
        "class": "OCA\\GroupFolders\\Versions\\VersionsBackend",
        "type": "->",
        "args": [
          "1"
        ]
      },
      {
        "file": "/var/www/nextcloud/apps/groupfolders/lib/Versions/GroupVersionsExpireManager.php",
        "line": 53,
        "function": "getAllVersionedFiles",
        "class": "OCA\\GroupFolders\\Versions\\VersionsBackend",
        "type": "->",
        "args": [
          {
            "id": "1",
            "mount_point": "StuRa",
            "groups": {
              "StuRa": "31"
            },
            "quota": "-3",
            "size": 0
          }
        ]
      },
      {
        "file": "/var/www/nextcloud/apps/groupfolders/lib/BackgroundJob/ExpireGroupVersions.php",
        "line": 40,
        "function": "expireAll",
        "class": "OCA\\GroupFolders\\Versions\\GroupVersionsExpireManager",
        "type": "->",
        "args": []
      },
      {
        "file": "/var/www/nextcloud/lib/private/BackgroundJob/Job.php",
        "line": 61,
        "function": "run",
        "class": "OCA\\GroupFolders\\BackgroundJob\\ExpireGroupVersions",
        "type": "->",
        "args": [
          null
        ]
      },

      {
        "file": "/var/www/nextcloud/lib/private/BackgroundJob/TimedJob.php",
        "line": 55,
        "function": "execute",
        "class": "OC\\BackgroundJob\\Job",
        "type": "->",
        "args": [
          {
            "__class__": "OC\\BackgroundJob\\JobList"
          },
          {
            "__class__": "OC\\Log"
          }
        ]
      },
      {
        "file": "/var/www/nextcloud/cron.php",
        "line": 123,
        "function": "execute",
        "class": "OC\\BackgroundJob\\TimedJob",
        "type": "->",
        "args": [
          {
            "__class__": "OC\\BackgroundJob\\JobList"
          },
          {
            "__class__": "OC\\Log"
          }
        ]
      }
    ],
    "File": "/var/www/nextcloud/apps/groupfolders/lib/Versions/VersionsBackend.php",
    "Line": 189,
    "CustomMessage": "--"
  },
  "userAgent": "--",
  "version": "15.0.0.10"
}
@iw0nderhow
Copy link

I'm encountering this error regularly also. I'm running the cronjob with PHP 7.0.33.

{"reqId":"OSFpw8Yg9fet4fWFKaLv","level":3,"time":"2018-12-19T08:30:02+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":{"Exception":"TypeError","Message":"Argument 1 passed to OCA\\GroupFolders\\Versions\\VersionsBackend::getVersionsFolder() must be of the type integer, string given, called in /var/www/html/apps/groupfolders/lib/Versions/VersionsBackend.php on line 154","Code":0,"Trace":[{"file":"/var/www/html/apps/groupfolders/lib/Versions/VersionsBackend.php","line":154,"function":"getVersionsFolder","class":"OCA\\GroupFolders\\Versions\\VersionsBackend","type":"->","args":["1"]},{"file":"/var/www/html/apps/groupfolders/lib/Versions/GroupVersionsExpireManager.php","line":53,"function":"getAllVersionedFiles","class":"OCA\\GroupFolders\\Versions\\VersionsBackend","type":"->","args":[{"id":"1","mount_point":"Familie","groups":{"group":"31"},"quota":"-3","size":0}]},{"file":"/var/www/html/apps/groupfolders/lib/Versions/GroupVersionsExpireManager.php","line":48,"function":"expireFolder","class":"OCA\\GroupFolders\\Versions\\GroupVersionsExpireManager","type":"->","args":[{"id":"1","mount_point":"Familie","groups":{"group":"31"},"quota":"-3","size":0}]},{"file":"/var/www/html/apps/groupfolders/lib/BackgroundJob/ExpireGroupVersions.php","line":40,"function":"expireAll","class":"OCA\\GroupFolders\\Versions\\GroupVersionsExpireManager","type":"->","args":[]},{"file":"/var/www/html/lib/private/BackgroundJob/Job.php","line":61,"function":"run","class":"OCA\\GroupFolders\\BackgroundJob\\ExpireGroupVersions","type":"->","args":[null]},{"file":"/var/www/html/lib/private/BackgroundJob/TimedJob.php","line":55,"function":"execute","class":"OC\\BackgroundJob\\Job","type":"->","args":[{"__class__":"OC\\BackgroundJob\\JobList"},{"__class__":"OC\\Log"}]},{"file":"/var/www/html/cron.php","line":123,"function":"execute","class":"OC\\BackgroundJob\\TimedJob","type":"->","args":[{"__class__":"OC\\BackgroundJob\\JobList"},{"__class__":"OC\\Log"}]}],"File":"/var/www/html/apps/groupfolders/lib/Versions/VersionsBackend.php","Line":189,"CustomMessage":"--"},"userAgent":"--","version":"15.0.0.10","id":"5c1a520b6cdc6"}

@freeyourcat
Copy link

freeyourcat commented Jan 5, 2019

I'm encountering the same problem with cronjob and PHP 7.2 after upgrading to Nextcloud 15.0 and Group folders 2.0.2.

Error message:
[cron] Error: TypeError: Argument 1 passed to OCA\GroupFolders\Versions\VersionsBackend::getVersionsFolder() must be of the type integer, string given, called in /var/www/nextcloud/apps/groupfolders/lib/Versions/VersionsBackend.php on line 154 at <>

  1. /var/www/nextcloud/apps/groupfolders/lib/Versions/VersionsBackend.php line 154
    getVersionsFolder("3")
  2. /var/www/nextcloud/apps/groupfolders/lib/Versions/GroupVersionsExpireManager.php line 53
    getAllVersionedFiles({id: "3",mount_p ... 0})
  3. /var/www/nextcloud/apps/groupfolders/lib/Versions/GroupVersionsExpireManager.php line 48
    expireFolder({id: "3",mount_p ... 0})
  4. /var/www/nextcloud/apps/groupfolders/lib/BackgroundJob/ExpireGroupVersions.php line 40
    expireAll()
  5. /var/www/nextcloud/lib/private/BackgroundJob/Job.php line 61
    run(null)
  6. /var/www/nextcloud/lib/private/BackgroundJob/TimedJob.php line 55
    execute(OC\BackgroundJob\JobList {}, OC\Log {})
  7. /var/www/nextcloud/cron.php line 123
    execute(OC\BackgroundJob\JobList {}, OC\Log {})

at 2019-01-05T05:15:03+00:00

@DrDeath
Copy link

DrDeath commented Jan 5, 2019

I think, it is not PHP Version related (String / Integer)

php 7.0.30
Nextcloud 15.0.0
Group Folders 2.0.2

[cron] Error: TypeError: Argument 1 passed to OCA\GroupFolders\Versions\VersionsBackend::getVersionsFolder() must be of the type integer, string given, called in /volume1/web/nextcloud/apps/groupfolders/lib/Versions/VersionsBackend.php on line 154 at <>

  1. /volume1/web/nextcloud/apps/groupfolders/lib/Versions/VersionsBackend.php line 154
    getVersionsFolder("1")
  2. /volume1/web/nextcloud/apps/groupfolders/lib/Versions/GroupVersionsExpireManager.php line 53
    getAllVersionedFiles({id: "1",mount_p ... 0})
  3. /volume1/web/nextcloud/apps/groupfolders/lib/Versions/GroupVersionsExpireManager.php line 48
    expireFolder({id: "1",mount_p ... 0})
  4. /volume1/web/nextcloud/apps/groupfolders/lib/BackgroundJob/ExpireGroupVersions.php line 40
    expireAll()
  5. /volume1/web/nextcloud/lib/private/BackgroundJob/Job.php line 61
    run(null)
  6. /volume1/web/nextcloud/lib/private/BackgroundJob/TimedJob.php line 55
    execute(OC\BackgroundJob\JobList {}, OC\Log {})
  7. /volume1/web/nextcloud/cron.php line 146
    execute(OC\BackgroundJob\JobList {}, OC\Log {})

GET /cron.php
from xxx.xxx.xxx.xxx at 2019-01-01T08:48:39+00:00

@freeyourcat
Copy link

i agree, it seems to be a type mismatch problem in the group folder app.. can we label this issue as a bug?

@maghog
Copy link

maghog commented Jan 16, 2019

Same problem...

[cron] Error: TypeError: Argument 1 passed to OCA\GroupFolders\Versions\VersionsBackend::getVersionsFolder() must be of the type integer, string given, called in /var/www/owncloud/apps/groupfolders/lib/Versions/VersionsBackend.php on line 154 at <>

  1. /var/www/owncloud/apps/groupfolders/lib/Versions/VersionsBackend.php line 154
    getVersionsFolder("1")
  2. /var/www/owncloud/apps/groupfolders/lib/Versions/GroupVersionsExpireManager.php line 53
    getAllVersionedFiles({id: "1",mount_p ... 0})
  3. /var/www/owncloud/apps/groupfolders/lib/Versions/GroupVersionsExpireManager.php line 48
    expireFolder({id: "1",mount_p ... 0})
  4. /var/www/owncloud/apps/groupfolders/lib/BackgroundJob/ExpireGroupVersions.php line 40
    expireAll()
  5. /var/www/owncloud/lib/private/BackgroundJob/Job.php line 61
    run(null)
  6. /var/www/owncloud/lib/private/BackgroundJob/TimedJob.php line 55
    execute(OC\BackgroundJob\JobList {}, OC\Log {})
  7. /var/www/owncloud/cron.php line 123
    execute(OC\BackgroundJob\JobList {}, OC\Log {})

at 2019-01-16T01:15:06+01:00

@mtippmann mtippmann changed the title PHP 7.3: TypeError: Argument 1 passed to OCA\\GroupFolders\\Versions\\VersionsBackend::getVersionsFolder() must be of the type int, string given, called in /var/www/nextcloud/apps/groupfolders/lib/Versions/VersionsBackend.php on line 154 TypeError: Argument 1 passed to OCA\\GroupFolders\\Versions\\VersionsBackend::getVersionsFolder() must be of the type int, string given, called in /var/www/nextcloud/apps/groupfolders/lib/Versions/VersionsBackend.php on line 154 Jan 16, 2019
@BornToBeRoot
Copy link

Same issue

TypeError: Argument 1 passed to OCA\GroupFolders\Versions\VersionsBackend::getVersionsFolder() must be of the type integer, string given, called in /var/www/html/nextcloud/apps/groupfolders/lib/Versions/VersionsBackend.php on line 154
/var/www/html/nextcloud/apps/groupfolders/lib/Versions/VersionsBackend.php - line 154:

OCA\GroupFolders\Versions\VersionsBackend->getVersionsFolder("1")

/var/www/html/nextcloud/apps/groupfolders/lib/Versions/GroupVersionsExpireManager.php - line 53:

OCA\GroupFolders\Versions\VersionsBackend->getAllVersionedFiles({ id: "1",mo ... 0})

/var/www/html/nextcloud/apps/groupfolders/lib/Versions/GroupVersionsExpireManager.php - line 48:

OCA\GroupFolders\Versions\GroupVersionsExpireManager->expireFolder({ id: "1",mo ... 0})

/var/www/html/nextcloud/apps/groupfolders/lib/BackgroundJob/ExpireGroupVersions.php - line 40:

OCA\GroupFolders\Versions\GroupVersionsExpireManager->expireAll()

/var/www/html/nextcloud/lib/private/BackgroundJob/Job.php - line 61:

OCA\GroupFolders\BackgroundJob\ExpireGroupVersions->run(null)

/var/www/html/nextcloud/lib/private/BackgroundJob/TimedJob.php - line 55:

OC\BackgroundJob\Job->execute(OC\BackgroundJob\JobList {}, OC\Log {})

/var/www/html/nextcloud/cron.php - line 123:

OC\BackgroundJob\TimedJob->execute(OC\BackgroundJob\JobList {}, OC\Log {})

@hriekehof
Copy link

hriekehof commented Feb 1, 2019

same issue

[cron] Error: TypeError: Argument 1 passed to OCA\GroupFolders\Versions\VersionsBackend::getVersionsFolder() must be of the type integer, string given, called in /var/www/html/custom_apps/groupfolders/lib/Versions/VersionsBackend.php on line 154 at <<closure>>

0. /var/www/html/custom_apps/groupfolders/lib/Versions/VersionsBackend.php line 154
   getVersionsFolder("2")
1. /var/www/html/custom_apps/groupfolders/lib/Versions/GroupVersionsExpireManager.php line 53
   getAllVersionedFiles({id: "2",mount_p ... 0})
2. /var/www/html/custom_apps/groupfolders/lib/Versions/GroupVersionsExpireManager.php line 48
   expireFolder({id: "2",mount_p ... 0})
3. /var/www/html/custom_apps/groupfolders/lib/BackgroundJob/ExpireGroupVersions.php line 40
   expireAll()
4. /var/www/html/lib/private/BackgroundJob/Job.php line 61
   run(null)
5. /var/www/html/lib/private/BackgroundJob/TimedJob.php line 55
   execute(OC\BackgroundJob\JobList {}, OC\Log {})
6. /var/www/html/cron.php line 123
   execute(OC\BackgroundJob\JobList {}, OC\Log {})

at 2019-02-01T07:45:07+00:00

@derdershat
Copy link

derdershat commented Feb 1, 2019

here too same issue
TypeError: Argument 1 passed to OCA\GroupFolders\Versions\VersionsBackend::getVersionsFolder() must be of the type integer, string given, called in /var/www/nextcloud/apps/groupfolders/lib/Versions/VersionsBackend.php on line 154

/var/www/nextcloud/apps/groupfolders/lib/Versions/VersionsBackend.php - line 154:

OCA\GroupFolders\Versions\VersionsBackend->getVersionsFolder("1")

/var/www/nextcloud/apps/groupfolders/lib/Versions/GroupVersionsExpireManager.php - line 53:

OCA\GroupFolders\Versions\VersionsBackend->getAllVersionedFiles({ id: "1",mo ... 0})

/var/www/nextcloud/apps/groupfolders/lib/Versions/GroupVersionsExpireManager.php - line 48:

OCA\GroupFolders\Versions\GroupVersionsExpireManager->expireFolder({ id: "1",mo ... 0})

/var/www/nextcloud/apps/groupfolders/lib/BackgroundJob/ExpireGroupVersions.php - line 40:

OCA\GroupFolders\Versions\GroupVersionsExpireManager->expireAll()

/var/www/nextcloud/lib/private/BackgroundJob/Job.php - line 61:

OCA\GroupFolders\BackgroundJob\ExpireGroupVersions->run(null)

/var/www/nextcloud/lib/private/BackgroundJob/TimedJob.php - line 55:

OC\BackgroundJob\Job->execute(OC\BackgroundJob\JobList {}, OC\Log {})

/var/www/nextcloud/cron.php - line 123:

OC\BackgroundJob\TimedJob->execute(OC\BackgroundJob\JobList {}, OC\Log {})

@tomastd
Copy link

tomastd commented Feb 4, 2019

Same issue here

  TypeError: Argument 1 passed to OCA\GroupFolders\Versions\VersionsBackend::getVersionsFolder() must be of the type integer, string given, called in /var/www/html/alastria/apps/groupfolders/lib/Versions/VersionsBackend.php on line 154

@virusuk
Copy link

virusuk commented Feb 6, 2019

The same here
TypeError: Argument 1 passed to OCA\GroupFolders\Versions\VersionsBackend::getVersionsFolder() must be of the type integer, string given, called in /var/www/nextcloud/apps/groupfolders/lib/Versions/VersionsBackend.php on line 154

@mnajamudinridha
Copy link

same issue

{"reqId":"o9GNaEAYuTbkJs2AS164","level":3,"time":"2019-02-06T20:15:03+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":{"Exception":"TypeError","Message":"Argument 1 passed to OCA\GroupFolders\Versions\VersionsBackend::getVersionsFolder() must be of the type integer, string given, called in /var/najacloud/apps/groupfolders/lib/Versions/VersionsBackend.php on line 154","Code":0,"Trace":[{"file":"/var/najacloud/apps/groupfolders/lib/Versions/VersionsBackend.php","line":154,"function":"getVersionsFolder","class":"OCA\GroupFolders\Versions\VersionsBackend","type":"->","args":["1"]},{"file":"/var/najacloud/apps/groupfolders/lib/Versions/GroupVersionsExpireManager.php","line":53,"function":"getAllVersionedFiles","class":"OCA\GroupFolders\Versions\VersionsBackend","type":"->","args":[{"id":"1","mount_point":"Folder Group","groups":[],"quota":"1073741274","size":0}]},{"file":"/var/najacloud/apps/groupfolders/lib/Versions/GroupVersionsExpireManager.php","line":48,"function":"expireFolder","class":"OCA\GroupFolders\Versions\GroupVersionsExpireManager","type":"->","args":[{"id":"1","mount_point":"Folder Group","groups":[],"quota":"1073741274","size":0}]},{"file":"/var/najacloud/apps/groupfolders/lib/BackgroundJob/ExpireGroupVersions.php","line":40,"function":"expireAll","class":"OCA\GroupFolders\Versions\GroupVersionsExpireManager","type":"->","args":[]},{"file":"/var/najacloud/lib/private/BackgroundJob/Job.php","line":61,"function":"run","class":"OCA\GroupFolders\BackgroundJob\ExpireGroupVersions","type":"->","args":[null]},{"file":"/var/najacloud/lib/private/BackgroundJob/TimedJob.php","line":55,"function":"execute","class":"OC\BackgroundJob\Job","type":"->","args":[{"class":"OC\BackgroundJob\JobList"},{"class":"OC\Log"}]},{"file":"/var/najacloud/cron.php","line":123,"function":"execute","class":"OC\BackgroundJob\TimedJob","type":"->","args":[{"class":"OC\BackgroundJob\JobList"},{"class":"OC\Log"}]}],"File":"/var/najacloud/apps/groupfolders/lib/Versions/VersionsBackend.php","Line":189,"CustomMessage":"--"},"userAgent":"--","version":"15.0.2.0","id":"5c5b97e7cb1b8"}

@MinIsMin
Copy link

MinIsMin commented Feb 7, 2019

Please stop writing "same issue" without contributing further.
The bug is known and every new "same here" only spams the people who subscribed to this issue.

@Sprinterfreak
Copy link
Contributor

Just a thought...
I changed apps/groupfolders/lib/Versions/VersionsBackend.php:154 to
$versionsFolder = $this->getVersionsFolder((int)$folder['id']);
added a forced cast to int. Now watch it over night. Sadly I can't force it to happen by running cron.php manually.

@fwolfst
Copy link

fwolfst commented Feb 16, 2019

@Sprinterfreak Did that work out? We could form a PR towards that.

@PpaiSanchez
Copy link

Hello, the mistake still exists. Since 18.12.2018 the error is known, and still it is not processed! When can a solution be expected?
Thank you.

Same on PHP 7.2 and NC 15.0.4.0 + Group folders 2.0.2:
[cron] Error: TypeError: Argument 1 passed to OCA\GroupFolders\Versions\VersionsBackend::getVersionsFolder() must be of the type integer, string given, called in /var/www/html/apps/groupfolders/lib/Versions/VersionsBackend.php on line 154 at <>

@Sprinterfreak
Copy link
Contributor

Sprinterfreak commented Feb 16, 2019

@fwolfst worked out partially but moved the issue to the next level. I didn't invetigated it further until now but I think the cast should happen at that point where the array of group folder configuration is collected.
Still strange because I normally expect php to cast stuff on its own.

Couldn't resist now.
In apps/groupfolders/lib/Folder/FolderManager.php

        public function getAllFolders() {
                $applicableMap = $this->getAllApplicable();

                $query = $this->connection->getQueryBuilder();

                $query->select('folder_id', 'mount_point', 'quota')
                        ->from('group_folders', 'f');

                $rows = $query->execute()->fetchAll();

                $folderMap = [];
                foreach ($rows as $row) {
                        $id = (int)$row['folder_id'];
                        $folderMap[$id] = [
                                'id' => $id,
                                'mount_point' => $row['mount_point'],
                                'groups' => isset($applicableMap[$id]) ? $applicableMap[$id] : [],
                                'quota' => $row['quota'],
                                'size' => 0
                        ];
                }

                return $folderMap;
        }

This is the location where things are collected. I allready added the cast $id = (int)$row['folder_id']; and going to watch it at the next Job->run();

Some classes declare declare(strict_types=1); This prevents php from casting if needed.

@Sprinterfreak
Copy link
Contributor

Sprinterfreak commented Feb 17, 2019

Still not. Now it's complaining

Undefined index: permissions at /var/www/nextcloud/apps/groupfolders/lib/Versions/VersionsBackend.php#155

Needs further investigating.

Sprinterfreak added a commit to Sprinterfreak/groupfolders that referenced this issue Feb 17, 2019
  * fixes nextcloud#267 logging errors
  * fixed followup error of undefined index 'permissions'
@Sprinterfreak
Copy link
Contributor

My PR forces id to be type integer instead of string wich solves this issue for me.
After that fixed a new error appeared in the code never reached before by the compiler. Someone tried to access indices wich cannot be supplied the way it was coded. If $folder['permissions'] is really needed by mountProvider->getMount(), my code has to be improved again because I just allow it to be missing (null) at this point. Doesn't seem to be an issue. Moar coffee to the devs. :)

@PpaiSanchez
Copy link

Now under Settings - Group Folder - under Groups only a 0 is displayed.

@Sprinterfreak
Copy link
Contributor

Kind of expected. The whole groupfolders expire manager module looks like someone has forgotten to stage half of his work during development. There are variables used, never defined before.
Like I mentioned earlier. I bet $folder['permissions'], wich is null at the moment and isn't possibly defined anywhere during previous execution because of entirely missing code, leads to this.
It didn't seem to affect the whole thing before, because the expire manager simply crashed entirely before beeing able to do anything. Now it's time to reverse engineer this thing and try to add the missing bits. @PpaiSanchez feel free to also participate.

Sprinterfreak added a commit to Sprinterfreak/groupfolders that referenced this issue Feb 18, 2019
icewind1991 added a commit that referenced this issue Feb 18, 2019
Followup patch fixing null permissions bug #267
@PpaiSanchez
Copy link

Thanks icewind1991, the code looks good now.

icewind1991 pushed a commit that referenced this issue Feb 21, 2019
  * fixes #267 logging errors
  * fixed followup error of undefined index 'permissions'
@Henk57
Copy link

Henk57 commented Jul 24, 2021

The errror seems back with NC 22.
Exception: Argument 1 passed to OC\Group\Manager::getUserIdGroupIds() must be of the type string, null given, called in /home/xxxx/domains/xxxx.nl/public_html/cloud/lib/private/Group/Manager.php on line 316

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.