server icon indicating copy to clipboard operation
server copied to clipboard

[Bug]: Call to a member function getPath() on null in /var/www/webs/cloud/cloud.de/lib/private/Files/Filesystem.php:775

Open sschwalbe opened this issue 2 years ago • 8 comments

⚠️ 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 (I've searched it).
  • [X] Nextcloud Server is up to date. See Maintenance and Release Schedule for supported versions.
  • [X] Nextcloud Server is running on 64bit capable CPU, PHP and OS.
  • [X] I agree to follow Nextcloud's Code of Conduct.

Bug description

cron output:

Error: Call to a member function getPath() on null in /var/www/webs/cloud/cloud.de/lib/private/Files/Filesystem.php:775
Stack trace:
#0 /var/www/webs/cloud/cloud.de/lib/private/Encryption/HookManager.php(40): OC\Files\Filesystem::getPath()
#1 /var/www/webs/cloud/cloud.de/lib/private/legacy/OC_Hook.php(105): OC\Encryption\HookManager::postUnshared()
#2 /var/www/webs/cloud/cloud.de/lib/private/Share20/LegacyHooks.php(83): OC_Hook::emit()
#3 /var/www/webs/cloud/cloud.de/3rdparty/symfony/event-dispatcher/EventDispatcher.php(264): OC\Share20\LegacyHooks->postUnshare()
#4 /var/www/webs/cloud/cloud.de/3rdparty/symfony/event-dispatcher/EventDispatcher.php(239): Symfony\Component\EventDispatcher\EventDispatcher->doDispatch()
#5 /var/www/webs/cloud/cloud.de/3rdparty/symfony/event-dispatcher/EventDispatcher.php(73): Symfony\Component\EventDispatcher\EventDispatcher->callListeners()
#6 /var/www/webs/cloud/cloud.de/lib/private/EventDispatcher/SymfonyAdapter.php(121): Symfony\Component\EventDispatcher\EventDispatcher->dispatch()
#7 /var/www/webs/cloud/cloud.de/lib/private/Share20/Manager.php(1247): OC\EventDispatcher\SymfonyAdapter->dispatch()
#8 /var/www/webs/cloud/cloud.de/lib/private/Share20/Manager.php(1555): OC\Share20\Manager->deleteShare()
#9 /var/www/webs/cloud/cloud.de/lib/private/Share20/Manager.php(1456): OC\Share20\Manager->checkExpireDate()
#10 /var/www/webs/cloud/cloud.de/apps/files_sharing/lib/ExpireSharesJob.php(99): OC\Share20\Manager->getShareById()
#11 /var/www/webs/cloud/cloud.de/lib/public/BackgroundJob/Job.php(78): OCA\Files_Sharing\ExpireSharesJob->run()
#12 /var/www/webs/cloud/cloud.de/lib/public/BackgroundJob/TimedJob.php(103): OCP\BackgroundJob\Job->start()
#13 /var/www/webs/cloud/cloud.de/lib/public/BackgroundJob/TimedJob.php(93): OCP\BackgroundJob\TimedJob->start()
#14 /var/www/webs/cloud/cloud.de/cron.php(152): OCP\BackgroundJob\TimedJob->execute()
#15 {main}

from the logs

> "reqId":"0Kj3kj2KDBJwEjhsGBf4","level":3,"time":"2022-05-31T16:15:03+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"Call to a member function getPath() on null","userAgent":"--","version":"24.0.1.1","e
> xception":{"Exception":"Error","Message":"Call to a member function getPath() on null","Code":0,"Trace":[{"file":"/var/www/webs/cloud/DOMAIN/lib/private/Encryption/Update.php","line":107,"function":"getPath","class":"OC\\Fi
> les\\Filesystem","type":"::"},{"file":"/var/www/webs/cloud/DOMAIN/lib/private/Encryption/HookManager.php","line":40,"function":"postUnshared","class":"OC\\Encryption\\Update","type":"->"},{"file":"/var/www/webs/cloud/DOMAIN/lib/private/legacy/OC_Hook.php","line":106,"function":"postUnshared","class":"OC\\Encryption\\HookManager","type":"::"},{"file":"/var/www/webs/cloud/DOMAIN/lib/private/Share20/LegacyHooks.php","line":84,"func
> tion":"emit","class":"OC_Hook","type":"::"},{"file":"/var/www/webs/cloud/DOMAIN/3rdparty/symfony/event-dispatcher/EventDispatcher.php","line":264,"function":"postUnshare","class":"OC\\Share20\\LegacyHooks","type":"->"},{"fi
> le":"/var/www/webs/cloud/DOMAIN/3rdparty/symfony/event-dispatcher/EventDispatcher.php","line":239,"function":"doDispatch","class":"Symfony\\Component\\EventDispatcher\\EventDispatcher","type":"->"},{"file":"/var/www/webs/am
> bar/DOMAIN/3rdparty/symfony/event-dispatcher/EventDispatcher.php","line":73,"function":"callListeners","class":"Symfony\\Component\\EventDispatcher\\EventDispatcher","type":"->"},{"file":"/var/www/webs/cloud/DOMAIN/lib/private/EventDispatcher/SymfonyAdapter.php","line":122,"function":"dispatch","class":"Symfony\\Component\\EventDispatcher\\EventDispatcher","type":"->"},{"file":"/var/www/webs/cloud/DOMAIN/lib/private/Share20/Mana
> ger.php","line":1247,"function":"dispatch","class":"OC\\EventDispatcher\\SymfonyAdapter","type":"->"},{"file":"/var/www/webs/cloud/DOMAIN/lib/private/Share20/Manager.php","line":1555,"function":"deleteShare","class":"OC\\Sh
> are20\\Manager","type":"->"},{"file":"/var/www/webs/cloud/DOMAIN/lib/private/Share20/Manager.php","line":1456,"function":"checkExpireDate","class":"OC\\Share20\\Manager","type":"->"},{"file":"/var/www/webs/cloud/DOMAIN/apps/files_sharing/lib/ExpireSharesJob.php","line":99,"function":"getShareById","class":"OC\\Share20\\Manager","type":"->"},{"file":"/var/www/webs/cloud/DOMAIN/lib/public/BackgroundJob/Job.php","line":79,"function
> ":"run","class":"OCA\\Files_Sharing\\ExpireSharesJob","type":"->"},{"file":"/var/www/webs/cloud/DOMAIN/lib/public/BackgroundJob/TimedJob.php","line":95,"function":"execute","class":"OCP\\BackgroundJob\\Job","type":"->"},{"f
> ile":"/var/www/webs/cloud/DOMAIN/cron.php","line":151,"function":"execute","class":"OCP\\BackgroundJob\\TimedJob","type":"->"}],"File":"/var/www/webs/cloud/DOMAIN/lib/private/Files/Filesystem.php","Line":795,"
> `CustomMessage":"--"}}`

Steps to reproduce

Is this the first time you’ve seen this error? : N Steps to replicate it: sometimes running

*/15 * * * * cloud /usr/bin/php8.1 -f /var/www/webs/cloud/DOMAIN/cron.php --define apc.enable_cli=1

Expected behavior

Update my Nextcloud

Installation method

None

Nextcloud Server version

26

Operating system

Debian/Ubuntu

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?

None

Are you using the Nextcloud Server Encryption module?

None

What user-backends are you using?

  • [ ] Default user-backend (database)
  • [ ] LDAP/ Active Directory
  • [ ] SSO - SAML
  • [ ] Other

Configuration report

The output of your config.php file in /path/to/nextcloud


<?php
$CONFIG = array (
  'instanceid' => '*******',
  'passwordsalt' => '*******',
  'secret' => '*********',
  'trusted_domains' =>.
  array (
    0 => 'cloud.domain',
  ),
  'datadirectory' => '/var/www/webs/cloud/cloud.domain/data',
  'dbtype' => 'mysql',
  'version' => '26.0.1.1',
  'overwrite.cli.url' => 'https://cloud.domain',
  'dbname' => 'cloudsql2',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'cloudsql2',
  'dbpassword' => '*****',
  'installed' => true,
  'default_phone_region' => 'DE',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'mail_smtpmode' => 'smtp',
  'mail_sendmailmode' => 'smtp',
  'mail_smtpport' => '25',
  'app_install_overwrite' =>.
  array (
    0 => 'bruteforcesettings',
  ),
  'maintenance' => false,
  'theme' => '',
  'loglevel' => 4,
);


### List of activated Apps

```shell
sudo -u www-data php occ app:list
Enabled:
  - activity: 2.18.0
  - admin_audit: 1.16.0
  - bruteforcesettings: 2.6.0
  - calendar: 4.3.3
  - circles: 26.0.0
  - cloud_federation_api: 1.9.0
  - comments: 1.16.0
  - contacts: 5.2.0
  - dashboard: 7.6.0
  - dav: 1.25.0
  - deck: 1.9.2
  - federatedfilesharing: 1.16.0
  - federation: 1.16.0
  - files: 1.21.1
  - files_external: 1.18.0
  - files_pdfviewer: 2.7.0
  - files_rightclick: 1.5.0
  - files_sharing: 1.18.0
  - files_trashbin: 1.16.0
  - files_versions: 1.19.1
  - firstrunwizard: 2.15.0
  - imageconverter: 1.3.5
  - logreader: 2.11.0
  - lookup_server_connector: 1.14.0
  - mail: 3.1.1
  - maps: 1.0.2
  - nextcloud_announcements: 1.15.0
  - notes: 4.7.2
  - notifications: 2.14.0
  - oauth2: 1.14.0
  - ocdownloader: 1.9.1
  - password_policy: 1.16.0
  - phonetrack: 0.7.6
  - photos: 2.2.0
  - privacy: 1.10.0
  - provisioning_api: 1.16.0
  - recommendations: 1.5.0
  - related_resources: 1.1.0-alpha1
  - richdocuments: 8.0.1
  - richdocumentscode: 22.5.1301
  - serverinfo: 1.16.0
  - settings: 1.8.0
  - sharebymail: 1.16.0
  - spreed: 16.0.3
  - support: 1.9.0
  - survey_client: 1.14.0
  - suspicious_login: 4.4.0
  - systemtags: 1.16.0
  - tasks: 0.14.5
  - text: 3.7.2
  - theming: 2.1.1
  - twofactor_backupcodes: 1.15.0
  - twofactor_totp: 8.0.0-alpha.0
  - unsplash: 2.2.0
  - updatenotification: 1.16.0
  - user_status: 1.6.0
  - viewer: 1.10.0
  - weather_status: 1.6.0
  - workflowengine: 2.8.0
Disabled:
  - carnet: 0.24.6 (installed 0.24.6)
  - contactsinteraction: 1.7.0 (installed 1.6.0)
  - encryption: 2.14.0
  - groupfolders: 14.0.2 (installed 14.0.2)
  - user_ldap: 1.16.0
  - workflow_ocr: 1.26.1 (installed 1.26.1)

Nextcloud Signing status

No response

Nextcloud Logs

No response

Additional info

I know that there is already a solution for this problem -> https://github.com/nextcloud/server/pull/31771 -> https://github.com/nextcloud/server/issues/29674

Was already implemented in my Nextcloud and doesn't help

sschwalbe avatar May 16 '23 09:05 sschwalbe

Can anybody tell me, what is to be done? Do I have to install a patch, update the database? I am running with the newest nextcloud-version, but error still exists. Thank you!

Ecmoechr avatar Jul 28 '23 09:07 Ecmoechr

I got he error for the first time after updating my nextcloud instance from 27 to 28.0.1. In the log he is accompanied with the following one: Undefined array key 0 at /var/owncloud/nextcloud-install/apps/files/lib/Controller/ViewController.php#240.

samuelstein avatar Jan 09 '24 20:01 samuelstein

One of our users reported a problem with our 28.0.1 installation this morning and the error looks the similar.

{"reqId":"4DFiNayuVXiWI5a5oFFn","level":3,"time":"2024-01-15T07:41:07+00:00","remoteAddr":"xxx","user":"xxx","app":"index","method":"GET","url":"/apps/files/?dir=/&fileid=1372","message":"Call to a member function getPath() on null in file '/var/www/nextcloud/apps/files/lib/Controller/ViewController.php' line 240","userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36","version":"28.0.1.1","exception":{"Exception":"Exception","Message":"Call to a member function getPath() on null in file '/var/www/nextcloud/apps/files/lib/Controller/ViewController.php' line 240","Code":0,"Trace":[{"file":"/var/www/nextcloud/lib/private/AppFramework/App.php","line":184,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/Route/Router.php","line":315,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/var/www/nextcloud/lib/base.php","line":1069,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/var/www/nextcloud/index.php","line":39,"function":"handleRequest","class":"OC","type":"::"}],"File":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","Line":169,"Previous":{"Exception":"Error","Message":"Call to a member function getPath() on null","Code":0,"Trace":[{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":230,"function":"index","class":"OCA\\Files\\Controller\\ViewController","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":137,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/App.php","line":184,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/Route/Router.php","line":315,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/var/www/nextcloud/lib/base.php","line":1069,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/var/www/nextcloud/index.php","line":39,"function":"handleRequest","class":"OC","type":"::"}],"File":"/var/www/nextcloud/apps/files/lib/Controller/ViewController.php","Line":240},"message":"Call to a member function getPath() on null in file '/var/www/nextcloud/apps/files/lib/Controller/ViewController.php' line 240","exception":{},"CustomMessage":"Call to a member function getPath() on null in file '/var/www/nextcloud/apps/files/lib/Controller/ViewController.php' line 240"}}

belzebub40k avatar Jan 15 '24 07:01 belzebub40k

Same here for another user, also updated to 28 from 27. "url":"/nextcloud/index.php/apps/files/?dir=/&fileid=2","message":"Undefined array key 0 at /var/www/nextcloud/apps/files/lib/Controller/ViewController.php#240" and gets a 500 when trying to access his instance.

JappeHallunken avatar Jan 15 '24 21:01 JappeHallunken

@samuelstein @belzebub40k @JappeHallunken Your reported matters fixed in #42427 / #42524 and will be released in the next NC28 point release (you're welcome to apply and test the contents of #42524 though - it's already been merged for release - if you don't wish to to wait). Unfortunately I don't think your situations are directly related to the original reporter's issue though.

joshtrichards avatar Jan 15 '24 22:01 joshtrichards

@sschwalbe I'm also confused about your original report because your config is from v26.0.1, but your log entry is from v24.0.1.1. The log entry also seems to be from a year prior to your original report. In addition #31771 wasn't merged until after your report - it was still a work in process and the code evolved further so your early testing may not be representative of the end product.

@sschwalbe & @Ecmoechr - Are either of you still experiencing this with newer versions of NC?

joshtrichards avatar Jan 15 '24 22:01 joshtrichards

This issue has been automatically marked as stale because it has not had recent activity and seems to be missing some essential information. It will be closed if no further activity occurs. Thank you for your contributions.

nextcloud-command avatar Feb 15 '24 00:02 nextcloud-command

It's fixed for me in 28.0.2

samuelstein avatar Feb 15 '24 06:02 samuelstein