Server: Undefined index: debugMode in exception.php

Created on 29 May 2020  路  5Comments  路  Source: nextcloud/server

Steps to reproduce

  1. Unfortunately, I don't know.
  2. I was moving and adding 4 folders to the Nexcloud folder
  3. These folders are 715 MB with 15736 files
  4. During the sync, I got some 427 file locked errors on the client
  5. Trying to investigate why, I pulled the log and saw a few
Undefined index: debugMode at path/web/nextcloud/core/templates/exception.php#2
Undefined index: debugMode at path/web/nextcloud/core/templates/exception.php#17

It seems to me that the error message produces an error with itself.
That's what I am reporting here, about this debugMode not existing. Not about the file locked I mentioned.

Expected behaviour

When there is these types of errors, I expect the error to be logged in the nexcloud log file

Actual behaviour

The error fails to be added to the log, and instead I have Undefined index: debugMode in place of the actual error.

Server configuration

Operating system:
5.4.31-gentoo x86_64
Web server:
nginx/1.18.0
Database:
MariaDB Ver 10.4.8-MariaDB for Linux on x86_64 (Source distribution)
PHP version:
PHP 7.4.6
Nextcloud version: (see Nextcloud admin page)
18.0.4
Updated from an older Nextcloud/ownCloud or fresh install:
Updated from previous version
Where did you install Nextcloud from:
Web updater
Signing status:


Signing status
No errors have been found.

Nextcloud configuration:


Config report

{
    "system": {
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            ""***REMOVED SENSITIVE VALUE***",
            ""***REMOVED SENSITIVE VALUE***"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "version": "18.0.4.2",
        "dbtype": "mysql",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbtableprefix": "oc_",
        "installed": true,
        "mail_smtpmode": "smtp",
        "mail_smtpauthtype": "LOGIN",
        "mail_smtpsecure": "tls",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": ""***REMOVED SENSITIVE VALUE***",
        "mail_smtpauth": 1,
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
        "filelocking.enabled": true,
        "filesystem_check_changes": true,
        "files_external_allow_create_new_local": true,
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "memcache.distributed": "\\OC\\Memcache\\Redis",
        "memcache.local": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "port": 0,
            "timeout": 0
        },
        "maintenance": false,
        "theme": "",
        "loglevel": 2,
        "overwrite.cli.url": ""***REMOVED SENSITIVE VALUE***",
        "overwriteprotocol": "https",
        "mysql.utf8mb4": true,
        "has_rebuilt_cache": true,
        "updater.release.channel": "stable",
        "app_install_overwrite": [
            "dicomviewer"
        ]
    }
}

Are you using encryption: yes

Client configuration

Client:
2.6.4stable-win64 20200303
Operating system:
Windows 10 x64

0. Needs triage bug

Most helpful comment

Looks like <?php if ($_['debugMode']): ?> in https://github.com/nextcloud/server/blob/master/core/templates/exception.php isn't proper.

All 5 comments

Looks like <?php if ($_['debugMode']): ?> in https://github.com/nextcloud/server/blob/master/core/templates/exception.php isn't proper.

{"reqId":"mqBvxtP2YfDgce5QnHe2","level":3,"time":"2020-06-25T14:32:19+00:00","remoteAddr":"192.168.1.7","user":"xxxxxxxx","app":"PHP","method":"GET","url":"/remote.php/webdav/Documentos/Desloca%C3%A7%C3%B5es/ok_comunicacao_de_deslocacao.xls?downloadStartSecret=xxxxxxxx","message":"Undefined index: debugMode at /usr/share/webapps/nextcloud/core/templates/exception.php#26","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36","version":"19.0.0.12"}

Unable to download files

I faced the same problem. Cannot mount webdav, in logs there is

NOTICE: PHP message: {"reqId":"i8X9fjEGQyeltqQe4aLA","level":3,"time":"2020-09-03T16:19:05+02:00","remoteAddr":"10.36.129.181","user":"--","app":"PHP","method":"GET","url":"/remote.php/dav/files/domain-auth-47e01a24-b66e-48d7-8e30-e1693fe8d913/","message":"Undefined index: debugMode at /var/www/html/core/templates/exception.php#26","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2227.0 Safari/537.36","version":"19.0.1.1"}
NOTICE: PHP message: {"reqId":"i8X9fjEGQyeltqQe4aLA","level":3,"time":"2020-09-03T16:19:05+02:00","remoteAddr":"10.36.129.181","user":"--","app":"PHP","method":"GET","url":"/remote.php/dav/files/domain-auth-47e01a24-b66e-48d7-8e30-e1693fe8d913/","message":"chmod(): Operation not permitted at /var/www/html/lib/private/Log/File.php#86","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2227.0 Safari/537.36","version":"19.0.1.1"}

But globally webdav mount is working fine. Previously I disabled file locking due this suggestion https://github.com/nextcloud/server/issues/22542#issuecomment-685821345 because had problem, described in https://github.com/nextcloud/server/issues/22250

@rullzer I already added your commit https://github.com/nextcloud/server/pull/21657/commits/ac3137a16600a68fa7f6fde462be0cd197bd79ed#diff-8605447d0fae76935374aeb00a5954edR17 to my core/templates/exception.php, but still see the error.

Oh, I've may not seen a second appearance of debugMode in core/templates/exception.php.

Change line 26 from

<?php if ($_['debugMode']): ?>```

to

<?php if (isset($_['debugMode']) && $_['debugMode'] === true): ?>

I'll create another PR for this.

@timm2k much better, thank you!

Was this page helpful?
0 / 5 - 0 ratings