[Bug]: `Call to a member function getPath() on null` in file `ShareController.php`
⚠️ This issue respects the following points: ⚠️
- [X] This is a bug, not a question or a configuration/webserver/proxy issue.
- [X] This issue is not already reported on Github OR Nextcloud Community Forum (I've searched it).
- [X] Nextcloud Server is up to date. See Maintenance and Release Schedule for supported versions.
- [X] I agree to follow Nextcloud's Code of Conduct.
Bug description
In my log, have a lot error:
Exception Call to a member function getPath() on null in file '/var/www/html/nextcloud/apps/files_sharing/lib/Controller/ShareController.php' line 532
User not related any problems, but my log has several records similar to this
Steps to reproduce
I do no exactly how to reproduce
Expected behavior
No error logs
Nextcloud Server version
29
Operating system
RHEL/CentOS
PHP engine version
PHP 8.1
Web server
Apache (supported)
Database engine version
MariaDB
Is this bug present after an update or on a fresh install?
Upgraded to a MAJOR version (ex. 28 to 29)
Are you using the Nextcloud Server Encryption module?
Encryption is Disabled
What user-backends are you using?
- [X] Default user-backend (database)
- [ ] LDAP/ Active Directory
- [ ] SSO - SAML
- [ ] Other
Configuration report
"system": {
"instanceid": "***REMOVED SENSITIVE VALUE***",
"passwordsalt": "***REMOVED SENSITIVE VALUE***",
"secret": "***REMOVED SENSITIVE VALUE***",
"trusted_domains": [
"***REMOVED SENSITIVE VALUE***"
],
"datadirectory": "***REMOVED SENSITIVE VALUE***",
"dbtype": "mysql",
"version": "29.0.6.1",
"overwrite.cli.url": "http:\/\/XXX.XXX.XX.XXX",
"dbname": "***REMOVED SENSITIVE VALUE***",
"dbhost": "***REMOVED SENSITIVE VALUE***",
"dbport": "",
"dbtableprefix": "oc_",
"mysql.utf8mb4": true,
"dbuser": "***REMOVED SENSITIVE VALUE***",
"dbpassword": "***REMOVED SENSITIVE VALUE***",
"installed": true,
"maintenance_window_start": 1,
"default_language": "pt_BR",
"force_language": "pt_BR",
"default_phone_region": "pt_BR",
"app_install_overwrite": [
"documentserver_community",
"pdfdraw"
],
"maintenance": false,
"mail_smtpmode": "sendmail",
"mail_smtpport": "25",
"mail_from_address": "***REMOVED SENSITIVE VALUE***",
"mail_smtphost": "***REMOVED SENSITIVE VALUE***",
"mail_domain": "***REMOVED SENSITIVE VALUE***",
"mail_sendmailmode": "smtp",
"memcache.local": "\\OC\\Memcache\\APCu",
"memcache.distributed": "\\OC\\Memcache\\Redis",
"memcache.locking": "\\OC\\Memcache\\Redis",
"redis": {
"host": "***REMOVED SENSITIVE VALUE***",
"port": 0,
"timeout": 0
},
"loglevel": 2,
"loglevel_frontend": 2,
"mail_smtpsecure": "ssl",
"mail_smtpauth": 1,
"theme": "",
"enable_previews": false,
"token_auth_enforced": false,
"remember_login_cookie_lifetime": 14400,
"session_lifetime": 14400,
"session_relaxed_expiry": false,
"session_keepalive": true,
"auto_logout": true,
"defaultapp": "",
"enforce_theme": ""
}
List of activated Apps
Enabled:
- activity: 2.21.1
- admin_audit: 1.19.0
- breezedark: 29.0.0
- calendar: 4.7.16
- circles: 29.0.0-dev
- cloud_federation_api: 1.12.0
- comments: 1.19.0
- contacts: 6.0.0
- contactsinteraction: 1.10.0
- dashboard: 7.9.0
- dav: 1.30.1
- documentserver_community: 0.1.18
- federatedfilesharing: 1.19.0
- federation: 1.19.0
- files: 2.1.1
- files_downloadlimit: 2.0.0
- files_pdfviewer: 2.10.0
- files_reminders: 1.2.0
- files_sharing: 1.21.0
- files_trashbin: 1.19.0
- files_versions: 1.22.0
- firstrunwizard: 2.18.0
- fulltextsearch_elasticsearch: 29.0.1
- logreader: 2.14.0
- lookup_server_connector: 1.17.0
- mail: 3.7.8
- nextcloud_announcements: 1.18.0
- notes: 4.10.1
- notifications: 2.17.0
- oauth2: 1.17.0
- onlyoffice: 9.3.0
- password_policy: 1.19.0
- photos: 2.5.0
- privacy: 1.13.0
- provisioning_api: 1.19.0
- recommendations: 2.1.0
- related_resources: 1.4.0
- serverinfo: 1.19.0
- settings: 1.12.0
- sharebymail: 1.19.0
- spreed: 19.0.8
- support: 1.12.0
- survey_client: 1.17.0
- systemtags: 1.19.0
- text: 3.10.1
- theming: 2.4.0
- twofactor_backupcodes: 1.18.0
- twofactor_totp: 11.0.0-dev
- updatenotification: 1.19.1
- user_status: 1.9.0
- viewer: 2.3.0
- weather_status: 1.9.0
- workflowengine: 2.11.0
Disabled:
- bruteforcesettings: 2.9.0
- encryption: 2.17.0
- files_external: 1.21.0
- impersonate: 1.16.0 (installed 1.16.0)
- richdocuments: 8.4.6 (installed 8.4.6)
- suspicious_login: 7.0.0
- user_ldap: 1.20.0
Nextcloud Signing status
No errors have been found.
Nextcloud Logs
{
"reqId": "ZunrMwDonRrWiRHoGN84fwAAAM8",
"level": 3,
"time": "2024-09-17T20:48:51+00:00",
"remoteAddr": "xxx.xx.xxx.xxx",
"user": "--",
"app": "index",
"method": "GET",
"url": "/index.php/s/6zPrt8k2kWsdCWz/download?path=&files=",
"message": "Call to a member function getPath() on null in file '/var/www/html/nextcloud/apps/files_sharing/lib/Controller/ShareController.php' line 532",
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36",
"version": "29.0.6.1",
"exception": {
"Exception": "Exception",
"Message": "Call to a member function getPath() on null in file '/var/www/html/nextcloud/apps/files_sharing/lib/Controller/ShareController.php' line 532",
"Code": 0,
"Trace": [
{
"file": "/var/www/html/nextcloud/lib/private/AppFramework/App.php",
"line": 184,
"function": "dispatch",
"class": "OC\\AppFramework\\Http\\Dispatcher",
"type": "->"
},
{
"file": "/var/www/html/nextcloud/lib/private/Route/Router.php",
"line": 331,
"function": "main",
"class": "OC\\AppFramework\\App",
"type": "::"
},
{
"file": "/var/www/html/nextcloud/lib/base.php",
"line": 1058,
"function": "match",
"class": "OC\\Route\\Router",
"type": "->"
},
{
"file": "/var/www/html/nextcloud/index.php",
"line": 49,
"function": "handleRequest",
"class": "OC",
"type": "::"
}
],
"File": "/var/www/html/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
"Line": 170,
"Previous": {
"Exception": "Error",
"Message": "Call to a member function getPath() on null",
"Code": 0,
"Trace": [
{
"file": "/var/www/html/nextcloud/apps/files_sharing/lib/Controller/ShareController.php",
"line": 418,
"function": "singleFileDownloaded",
"class": "OCA\\Files_Sharing\\Controller\\ShareController",
"type": "->"
},
{
"file": "/var/www/html/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
"line": 232,
"function": "downloadShare",
"class": "OCA\\Files_Sharing\\Controller\\ShareController",
"type": "->"
},
{
"file": "/var/www/html/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
"line": 138,
"function": "executeController",
"class": "OC\\AppFramework\\Http\\Dispatcher",
"type": "->"
},
{
"file": "/var/www/html/nextcloud/lib/private/AppFramework/App.php",
"line": 184,
"function": "dispatch",
"class": "OC\\AppFramework\\Http\\Dispatcher",
"type": "->"
},
{
"file": "/var/www/html/nextcloud/lib/private/Route/Router.php",
"line": 331,
"function": "main",
"class": "OC\\AppFramework\\App",
"type": "::"
},
{
"file": "/var/www/html/nextcloud/lib/base.php",
"line": 1058,
"function": "match",
"class": "OC\\Route\\Router",
"type": "->"
},
{
"file": "/var/www/html/nextcloud/index.php",
"line": 49,
"function": "handleRequest",
"class": "OC",
"type": "::"
}
],
"File": "/var/www/html/nextcloud/apps/files_sharing/lib/Controller/ShareController.php",
"Line": 532
},
"message": "Call to a member function getPath() on null in file '/var/www/html/nextcloud/apps/files_sharing/lib/Controller/ShareController.php' line 532",
"exception": [],
"CustomMessage": "Call to a member function getPath() on null in file '/var/www/html/nextcloud/apps/files_sharing/lib/Controller/ShareController.php' line 532"
},
"id": "66eaccad9b5cf"
}```
### Additional info
_No response_
I had the same error for a client.
Deep diving into the code, it seems that when a user (A) shares a file uploaded by a user (B) everything works as the user A is listed in the sharing list.
But publishing the "download activity" in the Activity feed of the user A is not working and generates this bug.
To bypass the problem $userPath can be assigned to $ownerPath. It's dirty but it works. Also it will "break" the Activity feed as the links to the files will not work.
Disabling the Activity app does not fix the problem.
Hopefully that will help anybody who will fix this bug
@sbouafif thanks that worked – quite an annoying bug. Curious why not more people seem to experience it
Fixed in #51458
This issue has been automatically locked because it has been closed for more than 14 days. As we do not monitor closed issues, we are locking this issue to prevent further comments from getting lost in the noise. Please open a new issue if you have a similar problem instead. For general discussions, please use our forum: https://help.nextcloud.com