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

PHP error on cron jobs (trashbin.php) #143

Closed
s7b4 opened this issue Jun 16, 2016 · 7 comments · Fixed by #164
Closed

PHP error on cron jobs (trashbin.php) #143

s7b4 opened this issue Jun 16, 2016 · 7 comments · Fixed by #164
Assignees
Labels

Comments

@s7b4
Copy link

s7b4 commented Jun 16, 2016

Steps to reproduce

  1. Configure system cron jobs

Expected behaviour

No fatal php errors should be triggered.

Actual behaviour

Fatal error is sent by cron :
PHP Fatal error: Call to a member function getUID() on null in /.../apps/admin_audit/lib/actions/trashbin.php on line 49

line is :
'user' => $this->userSession->getUser()->getUID()

Server configuration

Operating system:
Debian GNU/Linux 8.5 (jessie)

Web server:
Apache 2.4

Database:
Mysql 5.5

PHP version:
PHP 5.6.22

Nextcloud version: (see Nextcloud admin page)
9.0.50.0

Updated from an older Nextcloud/ownCloud or fresh install:
Updated from ownlcloud

Where did you install Nextcloud from:
https://download.nextcloud.com/server/releases/nextcloud-9.0.50.zip

Signing status (Nextcloud 9.0 and above):

No errors have been found.

List of activated apps:

Enabled:
  - activity: 2.2.1
  - admin_audit: 1.0.0
  - comments: 0.2
  - dav: 0.1.6
  - federatedfilesharing: 0.1.0
  - federation: 0.0.4
  - files: 1.4.4
  - files_external: 0.5.2
  - files_pdfviewer: 0.8.1
  - files_sharing: 0.9.1
  - files_texteditor: 2.1
  - files_trashbin: 0.8.0
  - files_videoplayer: 0.9.8
  - firstrunwizard: 1.1
  - gallery: 14.5.0
  - notifications: 0.2.3
  - systemtags: 0.2
  - templateeditor: 0.1
  - updatenotification: 0.1.0
Disabled:
  - encryption
  - external
  - files_versions
  - provisioning_api
  - user_external
  - user_ldap

The content of config/config.php:

{
    "system": {
        "installed": true,
        "dbtype": "mysql",
        "dbname": "owncloud",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "localhost",
        "dbtableprefix": "oc_",
        "forcessl": true,
        "defaultapp": "files",
        "appstoreenabled": true,
        "mail_smtpmode": "smtp",
        "mail_smtphost": "127.0.0.1",
        "appcodechecker": false,
        "updatechecker": true,
        "log_type": "owncloud",
        "loglevel": 3,
        "datadirectory": "...\/owncloud",
        "asset-pipeline.enabled": false,
        "has_internet_connection": true,
        "apps_paths": [
            {
                "path": "...\/apps",
                "url": "\/apps",
                "writable": true
            },
            {
                "path": "...\/apps-extra",
                "url": "\/apps-extra",
                "writable": true
            }
        ],
        "instanceid": "50ae344a0fcbe",
        "version": "9.0.50.0",
        "maxZipInputSize": 536870912,
        "allowZipDownload": true,
        "maintenance": false,
        "theme": "",
        "trusted_domains": [
            "cloud.sbaron.fr"
        ],
        "mail_from_address": "no-reply",
        "mail_domain": "",
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "forceSSLforSubdomains": true,
        "memcache.local": "\\OC\\Memcache\\Redis",
        "filelocking.enabled": "true",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "trashbin_retention_obligation": "auto",
        "updater.secret": "***REMOVED SENSITIVE VALUE***"
    }
}

Are you using external storage, if yes which one: local/smb/sftp/...
local

Are you using encryption: yes/no
no

Are you using an external user-backend, if yes which one: LDAP/ActiveDirectory/Webdav/...
no

Logs

Web server error log

n/a

Nextcloud log (data/owncloud.log)

{"reqId":"5faYdfqPMSFzBcPg7RCC","remoteAddr":"","app":"core","message":"starting upgrade from 9.0.2.2 to 9.0.50.0","level":0,"time":"2016-06-16T17:48:42+00:00","method":"--","url":"--","user":"--"}
{"reqId":"lNNvoh8ZM1EnN7GaO6Db","remoteAddr":"","app":"PHP","message":"Call to a member function getUID() on null at \/home\/htdocs\/cloud.sbaron.fr\/apps\/admin_audit\/lib\/actions\/trashbin.php#49","level":3,"time":"2016-06-16T18:00:02+00:00","method":"--","url":"--","user":"--"}
{"reqId":"aoGZO0Mn8fOCjuKevlYA","remoteAddr":"","app":"PHP","message":"Call to a member function getUID() on null at \/home\/htdocs\/cloud.sbaron.fr\/apps\/admin_audit\/lib\/actions\/trashbin.php#49","level":3,"time":"2016-06-16T18:45:02+00:00","method":"--","url":"--","user":"--"}

@LukasReschke LukasReschke added this to the Nextcloud 9.1 milestone Jun 17, 2016
@LukasReschke
Copy link
Member

cc @schiessle

@LukasReschke
Copy link
Member

@schiessle We should remove

'user' => $this->userSession->getUser()->getUID()
and
'user' => $this->userSession->getUser()->getUID()
here. The actual user is already logged anyways by the logger.

@LukasReschke
Copy link
Member

Also valid for all other occurrences, we should remove all dependencies on the user session from there.

@hostingnuggets
Copy link

@s7b4 does your problem also appear under the Cron section in the the Admin of the web interface as red lamp (instead of green) with the following message:

Last cron job execution: 15 hours ago. Something seems wrong.

I have exactly the same error message in my log file and was wondering if it is this exact same issue which reports that my cron is not working correctly under the admin page of the web interface.

@s7b4
Copy link
Author

s7b4 commented Jun 19, 2016

Hi @hostingnuggets,
The lamp is green for me, the message is not repeted at every cron.
Regards.

Edit: The trashbin was empty, so cron was OK, If I delete another file, cron does not report itsel as ok. So your issue is probably the same.

@hostingnuggets
Copy link

@s7b4 thanks for your precision, I confirm my lamp is now also green and this issue does not seem to appear at every run of cron.

@schiessle
Copy link
Member

I will prepare a pull request

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

Successfully merging a pull request may close this issue.

5 participants