Skip to content

Trying to access array offset on value of type bool at Storage.php #19066

Description

@Skip75

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

Activity

  1. added
    0. Needs triagePending check for reproducibility or if it fits our roadmap
    on Jan 22, 2020
  2. added
    1. to developAccepted and waiting to be taken care of
    good first issueSmall tasks with clear documentation about how and in which place you need to fix things in.
    and removed
    0. Needs triagePending check for reproducibility or if it fits our roadmap
    on Jan 22, 2020
  3. kesselb commented on Jan 22, 2020

    @kesselb
    Contributor

    Make sense thanks for reporting 👍

    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

  4. Skip75 commented on Mar 12, 2020

    @Skip75
    Author

    Will it be fixed with Nextcloud 19 ? :)

  5. added a commit that references this issue on Apr 12, 2020
    b6c76f4
  6. kesselb commented on Apr 15, 2020

    @kesselb
    Contributor

    @rullzer you closed that issue accidentally?

  7. MorrisJobke commented on Apr 17, 2020

    @MorrisJobke
    Member

    Wrongly closed - reopen.

  8. MorrisJobke commented on Apr 17, 2020

    @MorrisJobke
    Member

    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.

  9. MorrisJobke commented on Apr 17, 2020

    @MorrisJobke
    Member

    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.

  10. added 2 commits that reference this issue on Apr 21, 2020
    d2dae7c
    e24e395
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    1. to developAccepted and waiting to be taken care ofbugfeature: versionsgood first issueSmall tasks with clear documentation about how and in which place you need to fix things in.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions