nextcloud / nextcloud/circles

OCA\\Circles\\Model\\ShareWrapper::getCircle(): Return value must be of type OCA\\Circles\\Model\\Circle, null returned in file 'apps/circles/lib/Model/ShareWrapper.php' line 263

Open
#2,077 2 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

0. Needs triage bug
Dominant language
JavaScript
Stars
177
Forks
68
Avg merge
2d 22h
Merged PRs (30d)
60

Description

similar to #1714 affects Version V31 (installed version V31.0.7)

Stack Trace:
{"reqId":"***","level":3,"time":"2025-07-31T16:57:21+00:00","remoteAddr":"****","user":"XXXX","app":"no app in context","method":"POST","url":"/ocs/v2.php/apps/files/api/v1/templates/create","message":"OCA\\Circles\\Model\\ShareWrapper::getCircle(): Return value must be of type OCA\\Circles\\Model\\Circle, null returned in file 'apps/circles/lib/Model/ShareWrapper.php' line 263","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:141.0) Gecko/20100101 Firefox/141.0","version":"31.0.7.1","exception":{"Exception":"Exception","Message":"OCA\\Circles\\Model\\ShareWrapper::getCircle(): Return value must be of type OCA\\Circles\\Model\\Circle, null returned in file 'apps/circles/lib/Model/ShareWrapper.php' line 263","Code":0,"Trace":[{"file":"lib/private/AppFramework/App.php","line":161,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"lib/private/Route/Router.php","line":315,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"ocs/v1.php","line":49,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"ocs/v2.php","line":7,"args":["ocs/v1.php"],"function":"require_once"}],"File":"lib/private/AppFramework/Http/Dispatcher.php","Line":146,"Previous":{"Exception":"TypeError","Message":"OCA\\Circles\\Model\\ShareWrapper::getCircle(): Return value must be of type OCA\\Circles\\Model\\Circle, null returned","Code":0,"Trace":[{"file":"apps/circles/lib/ShareByCircleProvider.php","line":673,"function":"getCircle","class":"OCA\\Circles\\Model\\ShareWrapper","type":"->"},{"file":"lib/private/Share20/Manager.php","line":1700,"function":"getAccessList","class":"OCA\\Circles\\ShareByCircleProvider","type":"->"},{"file":"lib/private/Share20/ShareHelper.php","line":33,"function":"getAccessList","class":"OC\\Share20\\Manager","type":"->"},{"file":"apps/activity/lib/FilesHooks.php","line":584,"function":"getPathsForAccessList","class":"OC\\Share20\\ShareHelper","type":"->"},{"file":"apps/activity/lib/FilesHooks.php","line":152,"function":"getUserPathsFromPath","class":"OCA\\Activity\\FilesHooks","type":"->"},{"file":"apps/activity/lib/FilesHooks.php","line":82,"function":"addNotificationsForFileAction","class":"OCA\\Activity\\FilesHooks","type":"->"},{"file":"apps/activity/lib/FilesHooksStatic.php","line":27,"function":"fileCreate","class":"OCA\\Activity\\FilesHooks","type":"->"},{"file":"lib/private/legacy/OC_Hook.php","line":85,"function":"fileCreate","class":"OCA\\Activity\\FilesHooksStatic","type":"::"},{"file":"lib/private/Files/View.php","line":1322,"function":"emit","class":"OC_Hook","type":"::"},{"file":"lib/private/Files/View.php","line":1254,"function":"runHooks","class":"OC\\Files\\View","type":"->"},{"file":"lib/private/Files/View.php","line":529,"function":"basicOperation","class":"OC\\Files\\View","type":"->"},{"file":"lib/private/Files/Node/Folder.php","line":171,"function":"touch","class":"OC\\Files\\View","type":"->"},{"file":"lib/private/Files/Template/TemplateManager.php","line":174,"function":"newFile","class":"OC\\Files\\Node\\Folder","type":"->"},{"file":"apps/files/lib/Controller/TemplateController.php","line":94,"function":"createFromTemplate","class":"OC\\Files\\Template\\TemplateManager","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"lib/private/AppFramework/Http/Dispatcher.php","line":200,"function":"create","class":"OCA\\Files\\Controller\\TemplateController","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"lib/private/AppFramework/Http/Dispatcher.php","line":114,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"lib/private/AppFramework/App.php","line":161,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"lib/private/Route/Router.php","line":315,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"ocs/v1.php","line":49,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"ocs/v2.php","line":7,"args":["ocs/v1.php"],"function":"require_once"}],"File":"apps/circles/lib/Model/ShareWrapper.php","Line":263},"message":"OCA\\Circles\\Model\\ShareWrapper::getCircle(): Return value must be of type OCA\\Circles\\Model\\Circle, null returned in file 'apps/circles/lib/Model/ShareWrapper.php' line 263","exception":{},"CustomMessage":"OCA\\Circles\\Model\\ShareWrapper::getCircle(): Return value must be of type OCA\\Circles\\Model\\Circle, null returned in file 'apps/circles/lib/Model/ShareWrapper.php' line 263"}}

It seems that PR #1708 was applied only to V30 and earlier but not to V31, since
the code is present in https://github.com/nextcloud/circles/blob/v30.0.10/lib/ShareByCircleProvider.php#L672 but not in https://github.com/nextcloud/circles/blob/v31.0.7/lib/ShareByCircleProvider.php#L672

When we apply the PR #1708 in our installtaion (V31.0.7) the error does not occur anymore

@ArtificialOwl

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Inspect apps/circles/lib/Model/ShareWrapper.php around line 263 and apps/circles/lib/ShareByCircleProvider.php around line 672. Compare the v31 code with the v30 version and PR #1708, then verify that creating a file template no longer produces the getCircle() TypeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.