Skip to content

Conversation

@solracsf
Copy link
Member

Summary

TeamManager::getSharedWithList() receives an array of team ID strings from TeamsApiController, but its fallback code path tries to call getId() on those strings as if they were Team objects.

$sharesPerTeams = $this->teamManager->getSharedWithList(array_map(fn (Team $team): string => $team->getId(), $teams), $this->userId);

This PR changes the fallback to treat $teams as an array of IDs and matches the actual input contract from the controller to avoid the type error.

Type error stack
{
  "reqId": "kfnWhMgNo3FHFARdoSjn",
  "level": 3,
  "time": "2025-12-16T08:27:25+01:00",
  "remoteAddr": "19.133.41.27",
  "user": "WBE4",
  "app": "no app in context",
  "method": "GET",
  "url": "/ocs/v2.php/teams/resources/deck/85",
  "message": "Call to a member function getId() on string in file '/var/www/nextcloud/lib/private/Teams/TeamManager.php' line 97",
  "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36",
  "version": "31.0.12.3",
  "exception": {
    "Exception": "Exception",
    "Message": "Call to a member function getId() on string in file '/var/www/nextcloud/lib/private/Teams/TeamManager.php' line 97",
    "Code": 0,
    "Trace": [
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/App.php",
        "line": 161,
        "function": "dispatch",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->",
        "args": [
          {
            "__class__": "OC\\Core\\Controller\\TeamsApiController"
          },
          "listTeams"
        ]
      },
      {
        "file": "/var/www/nextcloud/lib/private/Route/Router.php",
        "line": 315,
        "function": "main",
        "class": "OC\\AppFramework\\App",
        "type": "::",
        "args": [
          "OC\\Core\\Controller\\TeamsApiController",
          "listTeams",
          {
            "__class__": "OC\\AppFramework\\DependencyInjection\\DIContainer"
          },
          {
            "providerId": "deck",
            "resourceId": "85",
            "_route": "ocs.core.teamsapi.listteams"
          }
        ]
      },
      {
        "file": "/var/www/nextcloud/ocs/v1.php",
        "line": 49,
        "function": "match",
        "class": "OC\\Route\\Router",
        "type": "->",
        "args": [
          "/ocsapp/teams/resources/deck/85"
        ]
      },
      {
        "file": "/var/www/nextcloud/ocs/v2.php",
        "line": 7,
        "args": [
          "/var/www/nextcloud/ocs/v1.php"
        ],
        "function": "require_once"
      }
    ],
    "File": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
    "Line": 146,
    "Previous": {
      "Exception": "Error",
      "Message": "Call to a member function getId() on string",
      "Code": 0,
      "Trace": [
        {
          "file": "/var/www/nextcloud/core/Controller/TeamsApiController.php",
          "line": 68,
          "function": "getSharedWithList",
          "class": "OC\\Teams\\TeamManager",
          "type": "->",
          "args": [
            [
              "y7C8gdZWHIAnLHcab7wcycX5mUIAC7J"
            ],
            "WBE4"
          ]
        },
        {
          "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
          "line": 200,
          "function": "listTeams",
          "class": "OC\\Core\\Controller\\TeamsApiController",
          "type": "->",
          "args": [
            "deck",
            "85"
          ]
        },
        {
          "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
          "line": 114,
          "function": "executeController",
          "class": "OC\\AppFramework\\Http\\Dispatcher",
          "type": "->",
          "args": [
            {
              "__class__": "OC\\Core\\Controller\\TeamsApiController"
            },
            "listTeams"
          ]
        },
        {
          "file": "/var/www/nextcloud/lib/private/AppFramework/App.php",
          "line": 161,
          "function": "dispatch",
          "class": "OC\\AppFramework\\Http\\Dispatcher",
          "type": "->",
          "args": [
            {
              "__class__": "OC\\Core\\Controller\\TeamsApiController"
            },
            "listTeams"
          ]
        },
        {
          "file": "/var/www/nextcloud/lib/private/Route/Router.php",
          "line": 315,
          "function": "main",
          "class": "OC\\AppFramework\\App",
          "type": "::",
          "args": [
            "OC\\Core\\Controller\\TeamsApiController",
            "listTeams",
            {
              "__class__": "OC\\AppFramework\\DependencyInjection\\DIContainer"
            },
            {
              "providerId": "deck",
              "resourceId": "85",
              "_route": "ocs.core.teamsapi.listteams"
            }
          ]
        },
        {
          "file": "/var/www/nextcloud/ocs/v1.php",
          "line": 49,
          "function": "match",
          "class": "OC\\Route\\Router",
          "type": "->",
          "args": [
            "/ocsapp/teams/resources/deck/85"
          ]
        },
        {
          "file": "/var/www/nextcloud/ocs/v2.php",
          "line": 7,
          "args": [
            "/var/www/nextcloud/ocs/v1.php"
          ],
          "function": "require_once"
        }
      ],
      "File": "/var/www/nextcloud/lib/private/Teams/TeamManager.php",
      "Line": 97
    },
    "message": "Call to a member function getId() on string in file '/var/www/nextcloud/lib/private/Teams/TeamManager.php' line 97",
    "exception": [],
    "CustomMessage": "Call to a member function getId() on string in file '/var/www/nextcloud/lib/private/Teams/TeamManager.php' line 97"
  },
  "id": "6942ae4e5ace5"
}

Checklist

@solracsf solracsf added this to the Nextcloud 33 milestone Dec 17, 2025
@solracsf solracsf requested a review from a team as a code owner December 17, 2025 14:18
@solracsf solracsf added bug 3. to review Waiting for reviews labels Dec 17, 2025
@solracsf solracsf requested review from Altahrim, ArtificialOwl, CarlSchwan, icewind1991 and salmart-dev and removed request for a team December 17, 2025 14:18
@solracsf solracsf marked this pull request as draft December 17, 2025 14:23
@solracsf solracsf changed the title fix(Teams): Use team IDs on teams iteration fix(Teams): Use string team IDs on teams iteration Dec 17, 2025
Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants