Server: Trying to access array offset on value of type bool at Storage.php

Created on 22 Jan 2020  路  6Comments  路  Source: nextcloud/server

Actual behaviour

Getting reppeatedly below errors in log :

鈥▄
  "reqId": "qStsHNXpUsBjPWyODopP",
  "level": 3,
  "time": "2020-01-22T00:07:28+01:00",
  "remoteAddr": "",
  "user": "--",
  "app": "PHP",
  "method": "",
  "url": "--",
  "message": "Trying to access array offset on value of type bool at /var/www/nextcloud/apps/files_versions/lib/Storage.php#654",
  "userAgent": "--",
  "version": "18.0.0.10",
  "id": "5e278de857424"
}

and

{
  "reqId": "qStsHNXpUsBjPWyODopP",
  "level": 3,
  "time": "2020-01-22T00:07:28+01:00",
  "remoteAddr": "",
  "user": "--",
  "app": "PHP",
  "method": "",
  "url": "--",
  "message": "Trying to access array offset on value of type bool at /var/www/nextcloud/apps/files_versions/lib/Storage.php#653",
  "userAgent": "--",
  "version": "18.0.0.10",
  "id": "5e278de857431"
}

Server configuration

Operating system: CentOS 8

Web server: Apache 2.4

Database: MariaDB

PHP version:

PHP 7.4.1 (cli) (built: Dec 17 2019 16:35:58) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.1, Copyright (c), by Zend Technologies

Nextcloud version: NC 18

fresh install

Signing status:


Signing status

No errors have been found.

List of activated apps:


App list

Enabled:
  - accessibility: 1.4.0
  - activity: 2.11.0
  - cloud_federation_api: 1.1.0
  - comments: 1.8.0
  - dav: 1.14.0
  - federatedfilesharing: 1.8.0
  - federation: 1.8.0
  - files: 1.13.1
  - files_pdfviewer: 1.7.0
  - files_rightclick: 0.15.2
  - files_sharing: 1.10.1
  - files_trashbin: 1.8.0
  - files_versions: 1.11.0
  - files_videoplayer: 1.7.0
  - firstrunwizard: 2.7.0
  - groupfolders: 6.0.0
  - logreader: 2.3.0
  - lookup_server_connector: 1.6.0
  - maps: 0.1.4
  - metadata: 0.11.1
  - nextcloud_announcements: 1.7.0
  - notifications: 2.6.0
  - oauth2: 1.6.0
  - password_policy: 1.8.0
  - photos: 1.0.0
  - privacy: 1.2.0
  - provisioning_api: 1.8.0
  - recommendations: 0.6.0
  - serverinfo: 1.8.0
  - settings: 1.0.0
  - sharebymail: 1.8.0
  - support: 1.1.0
  - survey_client: 1.6.0
  - systemtags: 1.8.0
  - text: 2.0.0
  - theming: 1.9.0
  - twofactor_backupcodes: 1.7.0
  - updatenotification: 1.8.0
  - viewer: 1.2.0
  - workflowengine: 2.0.0
Disabled:
  - admin_audit
  - bruteforcesettings
  - encryption
  - files_external
  - user_ldap

Nextcloud configuration:


Config report

{
    "system": {
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "domain.ltd"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "mysql",
        "version": "18.0.0.10",
        "overwrite.cli.url": "https:\/\/domain.ltd",
        "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": false,
        "memcache.local": "\\OC\\Memcache\\APCu",
        "mail_smtpmode": "smtp",
        "mail_sendmailmode": "smtp",
        "mail_smtpsecure": "tls",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpauthtype": "LOGIN",
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": "587",
        "mail_smtpauth": 1,
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
        "logtimezone": "Europe\/Paris",
        "date.timezone": "Europe\/Paris",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "port": 6379,
            "password": "***REMOVED SENSITIVE VALUE***",
            "timeout": 0,
            "dbindex": 0
        }
    }
}

Are you using external storage, if yes which one: No

Are you using encryption: No

Are you using an external user-backend, if yes which one: No

Client configuration

Browser: Firefox 68

Operating system: W10

1. to develop bug versions good first issue

All 6 comments

Make sense thanks for reporting :+1:

Index: apps/files_versions/lib/Storage.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- apps/files_versions/lib/Storage.php (revision fc027ca80174159e84811895ad136e57d347c714)
+++ apps/files_versions/lib/Storage.php (date 1579702293299)
@@ -649,6 +649,9 @@
        }

        $firstVersion = reset($versions);
+       if ($firstVersion === false) {
+           return [$toDelete, $size];
+       }
        $firstKey = key($versions);
        $prevTimestamp = $firstVersion['version'];
        $nextVersion = $firstVersion['version'] - $step;

The list of versions seems to be empty hence reset will return false. Not bad to add a test case for empty list of versions: https://github.com/nextcloud/server/blob/master/apps/files_versions/tests/VersioningTest.php

But probably that's only a workaround. I'm not sure if "no versions" is a valid state.

cc @icewind1991 @rullzer

Will it be fixed with Nextcloud 19 ? :)

@rullzer you closed that issue accidentally?

Wrongly closed - reopen.

Wrongly closed - reopen.

It was closed because the tickets where listed in the "pending tickets" list and contained "Fix #NUMBER" in the title. So this was then in the body of the overview ticket and once it was merged GitHub assumed to close this ticket here as well.

It was closed because the tickets where listed in the "pending tickets" list and contained "Fix #NUMBER" in the title. So this was then in the body of the overview ticket and once it was merged GitHub assumed to close this ticket here as well.

I changed the title of those tickets.

Was this page helpful?
0 / 5 - 0 ratings