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

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

Closed
Skip75 opened this issue Jan 22, 2020 · 6 comments · Fixed by #20386 or #20506
Closed

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

Skip75 opened this issue Jan 22, 2020 · 6 comments · Fixed by #20386 or #20506
Labels
1. to develop Accepted and waiting to be taken care of bug feature: versions good first issue Small tasks with clear documentation about how and in which place you need to fix things in.

Comments

@Skip75
Copy link

Skip75 commented Jan 22, 2020

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

@Skip75 Skip75 added 0. Needs triage Pending check for reproducibility or if it fits our roadmap bug labels Jan 22, 2020
@kesselb kesselb added 18-feedback 1. to develop Accepted and waiting to be taken care of good first issue Small tasks with clear documentation about how and in which place you need to fix things in. and removed 0. Needs triage Pending check for reproducibility or if it fits our roadmap labels Jan 22, 2020
@kesselb
Copy link
Contributor

kesselb commented Jan 22, 2020

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

@Skip75
Copy link
Author

Skip75 commented Mar 12, 2020

Will it be fixed with Nextcloud 19 ? :)

@kesselb
Copy link
Contributor

kesselb commented Apr 15, 2020

@rullzer you closed that issue accidentally?

@rullzer rullzer mentioned this issue Apr 16, 2020
55 tasks
@MorrisJobke
Copy link
Member

Wrongly closed - reopen.

@MorrisJobke MorrisJobke reopened this Apr 17, 2020
@MorrisJobke
Copy link
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.

@MorrisJobke
Copy link
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.

backportbot-nextcloud bot pushed a commit that referenced this issue Apr 21, 2020
Signed-off-by: Liam JACK <liamjack@users.noreply.github.com>
backportbot-nextcloud bot pushed a commit that referenced this issue Apr 21, 2020
Signed-off-by: Liam JACK <liamjack@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1. to develop Accepted and waiting to be taken care of bug feature: versions good first issue Small tasks with clear documentation about how and in which place you need to fix things in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants