nextcloud / nextcloud/activity

Trying to access array offset on value of type null at /lib/FilesHooks.php#471

Open
#1,056 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

2. developing bug
Dominant language
JavaScript
Stars
145
Forks
72
Avg merge
6d 9h
Merged PRs (30d)
42

Description

Nextcloud 24.0.9.

{
  "reqId": "Ln4zf0y4OwEBrrxQBull",
  "level": 3,
  "time": "2023-01-20T07:59:14+00:00",
  "remoteAddr": "77.21.8.20",
  "user": "laris",
  "app": "PHP",
  "method": "MOVE",
  "url": "/remote.php/dav/files/laris/FOLDER%201/FOLDER%202",
  "message": "Trying to access array offset on value of type null at /var/www/nextcloud/apps/activity/lib/FilesHooks.php#471",
  "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36",
  "version": "24.0.9.2",
  "exception": {
    "Exception": "Error",
    "Message": "Trying to access array offset on value of type null at /var/www/nextcloud/apps/activity/lib/FilesHooks.php#471",
    "Code": 0,
    "Trace": [
      {
        "file": "/var/www/nextcloud/apps/activity/lib/FilesHooks.php",
        "line": 471,
        "function": "onError",
        "class": "OC\\Log\\ErrorHandler",
        "type": "::",
        "args": [
          2,
          "Trying to access array offset on value of type null",
          "/var/www/nextcloud/apps/activity/lib/FilesHooks.php",
          471
        ]
      },
      {
        "file": "/var/www/nextcloud/apps/activity/lib/FilesHooks.php",
        "line": 386,
        "function": "fileMoving",
        "class": "OCA\\Activity\\FilesHooks",
        "type": "->",
        "args": [
          "/FOLDER 1/FOLDER 2",
          "/FOLDER 1/FOLDER 3/FOLDER 4"
        ]
      },
      {
        "file": "/var/www/nextcloud/apps/activity/lib/FilesHooksStatic.php",
        "line": 79,
        "function": "fileMovePost",
        "class": "OCA\\Activity\\FilesHooks",
        "type": "->",
        "args": [
          "/FOLDER 1/FOLDER 2",
          "/FOLDER 1/FOLDER 3/FOLDER 4"
        ]
      },
      {
        "file": "/var/www/nextcloud/lib/private/legacy/OC_Hook.php",
        "line": 106,
        "function": "fileMovePost",
        "class": "OCA\\Activity\\FilesHooksStatic",
        "type": "::",
        "args": [
          [
            "/FOLDER 1/FOLDER 2",
            "/FOLDER 1/FOLDER 3/FOLDER 4"
          ]
        ]
      },
      {
        "file": "/var/www/nextcloud/lib/private/Files/View.php",
        "line": 866,
        "function": "emit",
        "class": "OC_Hook",
        "type": "::",
        "args": [
          "OC_Filesystem",
          "post_rename",
          [
            "/FOLDER 1/FOLDER 2",
            "/FOLDER 1/FOLDER 3/FOLDER 4"
          ]
        ]
      },
      {
        "file": "/var/www/nextcloud/apps/dav/lib/Connector/Sabre/Directory.php",
        "line": 455,
        "function": "rename",
        "class": "OC\\Files\\View",
        "type": "->",
        "args": [
          "/FOLDER 1/FOLDER 2",
          "/FOLDER 1/FOLDER 3/FOLDER 4"
        ]
      },
      {
        "file": "/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Tree.php",
        "line": 160,
        "function": "moveInto",
        "class": "OCA\\DAV\\Connector\\Sabre\\Directory",
        "type": "->",
        "args": [
          "1 - DOCUMENTS ADMINISTRATIFS",
          "files/laris/FOLDER 1/FOLDER 2",
          {
            "__class__": "OCA\\DAV\\Connector\\Sabre\\Directory"
          }
        ]
      },
      {
        "file": "/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php",
        "line": 612,
        "function": "move",
        "class": "Sabre\\DAV\\Tree",
        "type": "->",
        "args": [
          "files/laris/FOLDER 1/FOLDER 2",
          "files/laris/FOLDER 1/FOLDER 3/FOLDER 4"
        ]
      },
      {
        "file": "/var/www/nextcloud/3rdparty/sabre/event/lib/WildcardEmitterTrait.php",
        "line": 89,
        "function": "httpMove",
        "class": "Sabre\\DAV\\CorePlugin",
        "type": "->",
        "args": [
          {
            "__class__": "Sabre\\HTTP\\Request"
          },
          {
            "__class__": "Sabre\\HTTP\\Response"
          }
        ]
      },
      {
        "file": "/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php",
        "line": 472,
        "function": "emit",
        "class": "Sabre\\DAV\\Server",
        "type": "->",
        "args": [
          "method:MOVE",
          [
            {
              "__class__": "Sabre\\HTTP\\Request"
            },
            {
              "__class__": "Sabre\\HTTP\\Response"
            }
          ]
        ]
      },
      {
        "file": "/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php",
        "line": 253,
        "function": "invokeMethod",
        "class": "Sabre\\DAV\\Server",
        "type": "->",
        "args": [
          {
            "__class__": "Sabre\\HTTP\\Request"
          },
          {
            "__class__": "Sabre\\HTTP\\Response"
          }
        ]
      },
      {
        "file": "/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php",
        "line": 321,
        "function": "start",
        "class": "Sabre\\DAV\\Server",
        "type": "->",
        "args": []
      },
      {
        "file": "/var/www/nextcloud/apps/dav/lib/Server.php",
        "line": 358,
        "function": "exec",
        "class": "Sabre\\DAV\\Server",
        "type": "->",
        "args": []
      },
      {
        "file": "/var/www/nextcloud/apps/dav/appinfo/v2/remote.php",
        "line": 35,
        "function": "exec",
        "class": "OCA\\DAV\\Server",
        "type": "->",
        "args": []
      },
      {
        "file": "/var/www/nextcloud/remote.php",
        "line": 170,
        "args": [
          "/var/www/nextcloud/apps/dav/appinfo/v2/remote.php"
        ],
        "function": "require_once"
      }
    ],
    "File": "/var/www/nextcloud/lib/private/Log/ErrorHandler.php",
    "Line": 92,
    "CustomMessage": "--"
  },
  "id": "63ca86e66b7ca"
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with apps/activity/lib/FilesHooks.php at line 471 and trace the fileMoving call from line 386, using the MOVE paths in the report as context. Check how the null value reaches the array offset, then verify that the reported move no longer produces the PHP error.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.