server icon indicating copy to clipboard operation
server copied to clipboard

[Bug]: `strpos()` and/or `pathinfo()`: Passing null to parameter #1 ($haystack) of type string is deprecated

Open killerb77 opened this issue 2 years ago • 26 comments

⚠️ This issue respects the following points: ⚠️

  • [X] This is a bug, not a question or a configuration/webserver/proxy issue.
  • [X] This issue is not already reported on Github (I've searched it).
  • [X] Nextcloud Server is up to date. See Maintenance and Release Schedule for supported versions.
  • [X] Nextcloud Server is running on 64bit capable CPU, PHP and OS.
  • [X] I agree to follow Nextcloud's Code of Conduct.

Bug description

I am using the official docker image nextcloud 25. I am getting all kinds of error PHP messages regarding of type string is deprecated at. It's happening on file uploads, when nextcloud sends email notifications as well. I think it's related to the new version 25 using PHP 8.1. It started happening for version 25. Didn't happen on version 24 which uses PHP 8.0.

198488279-52dbfcb6-429e-45a0-b0b0-d4c941842b21

Steps to reproduce

1.Send a test email notification. 2.Or upload a file. 3.Then check the logs to see the error messages.

Expected behavior

Should not be getting these error messages.

Installation method

Community Docker image

Operating system

Debian/Ubuntu

PHP engine version

PHP 8.1

Web server

Apache (supported)

Database engine version

MariaDB

Is this bug present after an update or on a fresh install?

Fresh Nextcloud Server install

Are you using the Nextcloud Server Encryption module?

Encryption is Disabled

What user-backends are you using?

  • [X] Default user-backend (database)
  • [ ] LDAP/ Active Directory
  • [ ] SSO - SAML
  • [ ] Other

Configuration report

{
    "system": {
        "htaccess.RewriteBase": "\/",
        "memcache.local": "\\OC\\Memcache\\APCu",
        "apps_paths": [
            {
                "path": "\/var\/www\/html\/apps",
                "url": "\/apps",
                "writable": false
            },
            {
                "path": "\/var\/www\/html\/custom_apps",
                "url": "\/custom_apps",
                "writable": true
            }
        ],
        "overwriteprotocol": "https",
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "***REMOVED SENSITIVE VALUE***",
            "***REMOVED SENSITIVE VALUE***"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "mysql",
        "version": "25.0.0.18",
        "overwrite.cli.url": "https:\/\/***REMOVED SENSITIVE VALUE***",
        "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,
        "theme": "",
        "loglevel": 2,
        "default_phone_region": "US",
        "defaultapp": "files",
        "mail_smtpmode": "smtp",
        "mail_smtpsecure": "tls",
        "mail_sendmailmode": "smtp",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpauth": 1,
        "mail_smtpauthtype": "LOGIN",
        "mail_smtpport": "587",
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***"
    }
}

List of activated Apps

Enabled:
  - activity: 2.17.0
  - circles: 25.0.0
  - cloud_federation_api: 1.8.0
  - comments: 1.15.0
  - contactsinteraction: 1.6.0
  - dashboard: 7.5.0
  - dav: 1.24.0
  - federatedfilesharing: 1.15.0
  - federation: 1.15.0
  - files: 1.20.1
  - files_pdfviewer: 2.6.0
  - files_rightclick: 1.4.0
  - files_sharing: 1.17.0
  - files_trashbin: 1.15.0
  - files_versions: 1.18.0
  - firstrunwizard: 2.14.0
  - logreader: 2.10.0
  - lookup_server_connector: 1.13.0
  - nextcloud_announcements: 1.14.0
  - notifications: 2.13.1
  - oauth2: 1.13.0
  - onlyoffice: 7.6.8
  - password_policy: 1.15.0
  - photos: 2.0.0
  - privacy: 1.9.0
  - provisioning_api: 1.15.0
  - recommendations: 1.4.0
  - related_resources: 1.0.3
  - serverinfo: 1.15.0
  - settings: 1.7.0
  - sharebymail: 1.15.0
  - support: 1.8.0
  - survey_client: 1.13.0
  - systemtags: 1.15.0
  - text: 3.6.0
  - theming: 2.0.0
  - twofactor_backupcodes: 1.14.0
  - twofactor_totp: 7.0.0
  - updatenotification: 1.15.0
  - user_status: 1.5.0
  - viewer: 1.9.0
  - weather_status: 1.5.0
  - workflowengine: 2.7.0
Disabled:
  - admin_audit
  - bruteforcesettings
  - encryption
  - files_external
  - suspicious_login
  - user_ldap

Nextcloud Signing status

No errors have been found.

Nextcloud Logs

[PHP] Error: Error: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated at /var/www/html/lib/private/Files/Cache/Scanner.php#508 at <<closure>>

 0. <<closure>>
    OC\Log\ErrorHandler::onError(8192, "strpos(): Passi ... d", "/var/www/html/l ... p", 508)
 1. /var/www/html/lib/private/Files/Cache/Scanner.php line 508
    strpos(null, ".part/")
 2. /var/www/html/lib/private/Files/View.php line 1384
    OC\Files\Cache\Scanner::isPartialFile(null)
 3. /var/www/html/lib/private/Files/Node/HookConnector.php line 227
    OC\Files\View->getFileInfo(null)
 4. /var/www/html/lib/private/Files/Node/HookConnector.php line 113
    OC\Files\Node\HookConnector->getNodeForPath(null)
 5. /var/www/html/lib/private/legacy/OC_Hook.php line 106
    OC\Files\Node\HookConnector->postWrite([null])
 6. /var/www/html/apps/dav/lib/Connector/Sabre/File.php line 471
    OC_Hook::emit("OC_Filesystem", "post_write", [null])
 7. /var/www/html/apps/dav/lib/Connector/Sabre/File.php line 398
    OCA\DAV\Connector\Sabre\File->emitPostHooks(false)
 8. /var/www/html/apps/dav/lib/Connector/Sabre/Directory.php line 151
    OCA\DAV\Connector\Sabre\File->put(null)
 9. /var/www/html/apps/dav/lib/Upload/UploadFolder.php line 45
    OCA\DAV\Connector\Sabre\Directory->createFile("10485760", null)
10. /var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php line 1098
    OCA\DAV\Upload\UploadFolder->createFile("10485760", null)
11. /var/www/html/3rdparty/sabre/dav/lib/DAV/CorePlugin.php line 504
    Sabre\DAV\Server->createFile("uploads/bmw/web ... 0", null, null)
12. /var/www/html/3rdparty/sabre/event/lib/WildcardEmitterTrait.php line 89
    Sabre\DAV\CorePlugin->httpPut(Sabre\HTTP\Request {}, Sabre\HTTP\Response {})
13. /var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php line 472
    Sabre\DAV\Server->emit("method:PUT", [Sabre\HTTP\Requ ... }])
14. /var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php line 253
    Sabre\DAV\Server->invokeMethod(Sabre\HTTP\Request {}, Sabre\HTTP\Response {})
15. /var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php line 321
    Sabre\DAV\Server->start()
16. /var/www/html/apps/dav/lib/Server.php line 360
    Sabre\DAV\Server->exec()
17. /var/www/html/apps/dav/appinfo/v2/remote.php line 35
    OCA\DAV\Server->exec()
18. /var/www/html/remote.php line 167
    require_once("/var/www/html/a ... p")

Additional info

No response

killerb77 avatar Nov 02 '22 23:11 killerb77

cc @come-nc @nextcloud/server-backend

szaimen avatar Nov 03 '22 07:11 szaimen

Hello,

Yes, this warning is new to PHP 8.1 but should still not happen. The error comes from some code calling isPartialFile with null instead of a string, ~can you get the trace for one of these errors?~

[EDIT] My bad, the trace is at the end of the report, let me read that

come-nc avatar Nov 03 '22 09:11 come-nc

So, looking at the trace:

  1. OCA\DAV\Connector\Sabre\Directory->createFile("10485760", null) is called which attempts to create a file
  2. put(null) is called on the node instance just created
  3. That calls emitPostHooks(false), and for some reason the instance cannot figure out its path, and triggers a post hook with null as the path
  4. The listeners are not expecting null there and are triggerring errors.

I do not know if it is expected or not for the file instance there to have null in path property. I suspect it should not have null, or should not trigger hooks on the null path.

come-nc avatar Nov 03 '22 09:11 come-nc

It's definitely a PHP 8.1 issue. I built the docker container using php:8.0-apache-bullseye instead of the default php:8.1-apache-bullseye.

Everything works as it should without any of the error messages in the logs now, using PHP 8.0

Screenshot 2022-11-07 192950

killerb77 avatar Nov 08 '22 00:11 killerb77

The fact you see no error in PHP<8.1 does not mean there is no problem. Having this event fired with null path may have unexpected results in corner cases if it was not designed that way. We need to figure out if this is expected or not and fix either the listeners or the event.

come-nc avatar Nov 08 '22 10:11 come-nc

the stack trace looks like a chunked upload

PVince81 avatar Nov 17 '22 13:11 PVince81

Let me add 2 stack traces here if it helps. @PVince81 in both cases, these seem to be uploads, and in both, $file is null.

{
  "reqId": "7wajzDcxJ6mT7A0evgD3",
  "level": 3,
  "time": "2022-11-17T17:59:51+01:00",
  "app": "PHP",
  "method": "PUT",
  "url": "/remote.php/dav/uploads/jdajczgewand/web-file-upload-ac3bf0a766fb24b20f008899777052a2-1668703328327/31457280",
  "message": "strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated at /var/www/nextcloud/lib/private/Files/Cache/Scanner.php#502",
  "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36",
  "version": "24.0.7.1",
  "exception": {
    "Exception": "Error",
    "Message": "strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated at /var/www/nextcloud/lib/private/Files/Cache/Scanner.php#502",
    "Code": 0,
    "Trace": [
      {
        "function": "onError",
        "class": "OC\\Log\\ErrorHandler",
        "type": "::",
        "args": [
          8192,
          "strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated",
          "/var/www/nextcloud/lib/private/Files/Cache/Scanner.php",
          502
        ]
      },
      {
        "file": "/var/www/nextcloud/lib/private/Files/Cache/Scanner.php",
        "line": 502,
        "function": "strpos",
        "args": [
          null,
          ".part/"
        ]
      },
      {
        "file": "/var/www/nextcloud/lib/private/Files/View.php",
        "line": 1390,
        "function": "isPartialFile",
        "class": "OC\\Files\\Cache\\Scanner",
        "type": "::",
        "args": [
          null
        ]
      },
      {
        "file": "/var/www/nextcloud/lib/private/Files/Node/HookConnector.php",
        "line": 227,
        "function": "getFileInfo",
        "class": "OC\\Files\\View",
        "type": "->",
        "args": [
          null
        ]
      },
      {
        "file": "/var/www/nextcloud/lib/private/Files/Node/HookConnector.php",
        "line": 113,
        "function": "getNodeForPath",
        "class": "OC\\Files\\Node\\HookConnector",
        "type": "->",
        "args": [
          null
        ]
      },
      {
        "file": "/var/www/nextcloud/lib/private/legacy/OC_Hook.php",
        "line": 106,
        "function": "postWrite",
        "class": "OC\\Files\\Node\\HookConnector",
        "type": "->",
        "args": [
          [
            null
          ]
        ]
      },
      {
        "file": "/var/www/nextcloud/apps/dav/lib/Connector/Sabre/File.php",
        "line": 472,
        "function": "emit",
        "class": "OC_Hook",
        "type": "::",
        "args": [
          "OC_Filesystem",
          "post_write",
          [
            null
          ]
        ]
      },
      {
        "file": "/var/www/nextcloud/apps/dav/lib/Connector/Sabre/File.php",
        "line": 399,
        "function": "emitPostHooks",
        "class": "OCA\\DAV\\Connector\\Sabre\\File",
        "type": "->",
        "args": [
          false
        ]
      },
      {
        "file": "/var/www/nextcloud/apps/dav/lib/Connector/Sabre/Directory.php",
        "line": 164,
        "function": "put",
        "class": "OCA\\DAV\\Connector\\Sabre\\File",
        "type": "->",
        "args": [
          null
        ]
      },
      {
        "file": "/var/www/nextcloud/apps/dav/lib/Upload/UploadFolder.php",
        "line": 45,
        "function": "createFile",
        "class": "OCA\\DAV\\Connector\\Sabre\\Directory",
        "type": "->",
        "args": [
          "31457280",
          null
        ]
      },
      {
        "file": "/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php",
        "line": 1098,
        "function": "createFile",
        "class": "OCA\\DAV\\Upload\\UploadFolder",
        "type": "->",
        "args": [
          "31457280",
          null
        ]
      },
      {
        "file": "/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php",
        "line": 504,
        "function": "createFile",
        "class": "Sabre\\DAV\\Server",
        "type": "->",
        "args": [
          "uploads/jdajczgewand/web-file-upload-ac3bf0a766fb24b20f008899777052a2-1668703328327/31457280",
          null,
          null
        ]
      },
      {
        "file": "/var/www/nextcloud/3rdparty/sabre/event/lib/WildcardEmitterTrait.php",
        "line": 89,
        "function": "httpPut",
        "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:PUT",
          [
            {
              "__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": "--"
  }
}
{
  "reqId": "7wajzDcxJ6mT7A0evgD3",
  "level": 3,
  "time": "2022-11-17T17:59:51+01:00",
  "app": "PHP",
  "method": "PUT",
  "url": "/remote.php/dav/uploads/jdajczgewand/web-file-upload-ac3bf0a766fb24b20f008899777052a2-1668703328327/31457280",
  "message": "strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated at /var/www/nextcloud/lib/private/Files/Cache/Scanner.php#502",
  "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36",
  "version": "24.0.7.1",
  "exception": {
    "Exception": "Error",
    "Message": "strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated at /var/www/nextcloud/lib/private/Files/Cache/Scanner.php#502",
    "Code": 0,
    "Trace": [
      {
        "function": "onError",
        "class": "OC\\Log\\ErrorHandler",
        "type": "::",
        "args": [
          8192,
          "strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated",
          "/var/www/nextcloud/lib/private/Files/Cache/Scanner.php",
          502
        ]
      },
      {
        "file": "/var/www/nextcloud/lib/private/Files/Cache/Scanner.php",
        "line": 502,
        "function": "strpos",
        "args": [
          null,
          ".part/"
        ]
      },
      {
        "file": "/var/www/nextcloud/lib/private/Files/View.php",
        "line": 1390,
        "function": "isPartialFile",
        "class": "OC\\Files\\Cache\\Scanner",
        "type": "::",
        "args": [
          null
        ]
      },
      {
        "file": "/var/www/nextcloud/lib/private/Files/Node/HookConnector.php",
        "line": 227,
        "function": "getFileInfo",
        "class": "OC\\Files\\View",
        "type": "->",
        "args": [
          null
        ]
      },
      {
        "file": "/var/www/nextcloud/lib/private/Files/Node/HookConnector.php",
        "line": 113,
        "function": "getNodeForPath",
        "class": "OC\\Files\\Node\\HookConnector",
        "type": "->",
        "args": [
          null
        ]
      },
      {
        "file": "/var/www/nextcloud/lib/private/legacy/OC_Hook.php",
        "line": 106,
        "function": "postWrite",
        "class": "OC\\Files\\Node\\HookConnector",
        "type": "->",
        "args": [
          [
            null
          ]
        ]
      },
      {
        "file": "/var/www/nextcloud/apps/dav/lib/Connector/Sabre/File.php",
        "line": 472,
        "function": "emit",
        "class": "OC_Hook",
        "type": "::",
        "args": [
          "OC_Filesystem",
          "post_write",
          [
            null
          ]
        ]
      },
      {
        "file": "/var/www/nextcloud/apps/dav/lib/Connector/Sabre/File.php",
        "line": 399,
        "function": "emitPostHooks",
        "class": "OCA\\DAV\\Connector\\Sabre\\File",
        "type": "->",
        "args": [
          false
        ]
      },
      {
        "file": "/var/www/nextcloud/apps/dav/lib/Connector/Sabre/Directory.php",
        "line": 164,
        "function": "put",
        "class": "OCA\\DAV\\Connector\\Sabre\\File",
        "type": "->",
        "args": [
          null
        ]
      },
      {
        "file": "/var/www/nextcloud/apps/dav/lib/Upload/UploadFolder.php",
        "line": 45,
        "function": "createFile",
        "class": "OCA\\DAV\\Connector\\Sabre\\Directory",
        "type": "->",
        "args": [
          "31457280",
          null
        ]
      },
      {
        "file": "/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php",
        "line": 1098,
        "function": "createFile",
        "class": "OCA\\DAV\\Upload\\UploadFolder",
        "type": "->",
        "args": [
          "31457280",
          null
        ]
      },
      {
        "file": "/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php",
        "line": 504,
        "function": "createFile",
        "class": "Sabre\\DAV\\Server",
        "type": "->",
        "args": [
          "uploads/jdajczgewand/web-file-upload-ac3bf0a766fb24b20f008899777052a2-1668703328327/31457280",
          null,
          null
        ]
      },
      {
        "file": "/var/www/nextcloud/3rdparty/sabre/event/lib/WildcardEmitterTrait.php",
        "line": 89,
        "function": "httpPut",
        "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:PUT",
          [
            {
              "__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": "--"
  }
}

solracsf avatar Nov 24 '22 10:11 solracsf

@solracsf @killerb77 Can you try strict typing $path property in both lib/private/Files/FileInfo.php and apps/dav/lib/Connector/Sabre/Node.php and see if that brings a different error? Like this:

diff --git a/apps/dav/lib/Connector/Sabre/Node.php b/apps/dav/lib/Connector/Sabre/Node.php
index 1e32e74c325..f282d2ad639 100644
--- a/apps/dav/lib/Connector/Sabre/Node.php
+++ b/apps/dav/lib/Connector/Sabre/Node.php
@@ -60,7 +60,7 @@ abstract class Node implements \Sabre\DAV\INode {
         *
         * @var string
         */
-       protected $path;
+       protected string $path;
 
        /**
         * node properties cache
diff --git a/lib/private/Files/FileInfo.php b/lib/private/Files/FileInfo.php
index 47c893ebbf1..804c6d20482 100644
--- a/lib/private/Files/FileInfo.php
+++ b/lib/private/Files/FileInfo.php
@@ -45,7 +45,7 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess {
        /**
         * @var string $path
         */
-       private $path;
+       private string $path;
 
        /**
         * @var \OC\Files\Storage\Storage $storage

Because I cannot reproduce the error with a simple upload for the web UI I never have NULL in $path.

come-nc avatar Dec 01 '22 14:12 come-nc

This is not a "all time" reproductible bug. I can observe this is produced when users uploads many (+200 files), no matter the client. I've applied the patch, I'll report back.

solracsf avatar Dec 01 '22 14:12 solracsf

@come-nc

After applying above patch, I've seen an error I've never seen before, is it related? EDIT: it seem not related: https://github.com/nextcloud/server/issues/30626

{
  "reqId": "M5e0U2kx3xYuqItjLr0s",
  "level": 3,
  "time": "2022-12-01T17:10:27+01:00",
  "app": "webdav",
  "method": "POST",
  "url": "/remote.php/dav/bulk",
  "message": "Unknown error while seeking content",
  "userAgent": "Mozilla/5.0 (Windows) mirall/3.4.1stable-Win64 (build 20211221) (Nextcloud, windows-10.0.19044 ClientArchitecture: x86_64 OsArchitecture: x86_64)",
  "version": "25.0.1.1",
  "exception": {
    "Exception": "Sabre\\DAV\\Exception",
    "Message": "Unknown error while seeking content",
    "Code": 500,
    "Trace": [
      {
        "file": "/var/www/nextcloud/apps/dav/lib/BulkUpload/MultipartRequestParser.php",
        "line": 129,
        "function": "isAt",
        "class": "OCA\\DAV\\BulkUpload\\MultipartRequestParser",
        "type": "->",
        "args": [
          "--boundary_.oOo._SOGavCOmyLun2GM9ThBH7Q68TKWRD4OD--\r\n"
        ]
      },
      {
        "file": "/var/www/nextcloud/apps/dav/lib/BulkUpload/BulkUploadPlugin.php",
        "line": 71,
        "function": "isAtLastBoundary",
        "class": "OCA\\DAV\\BulkUpload\\MultipartRequestParser",
        "type": "->",
        "args": []
      },
      {
        "file": "/var/www/nextcloud/3rdparty/sabre/event/lib/WildcardEmitterTrait.php",
        "line": 89,
        "function": "httpPost",
        "class": "OCA\\DAV\\BulkUpload\\BulkUploadPlugin",
        "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:POST",
          [
            {
              "__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": 360,
        "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": 171,
        "args": [
          "/var/www/nextcloud/apps/dav/appinfo/v2/remote.php"
        ],
        "function": "require_once"
      }
    ],
    "File": "/var/www/nextcloud/apps/dav/lib/BulkUpload/MultipartRequestParser.php",
    "Line": 111,
    "message": "Unknown error while seeking content",
    "exception": [],
    "CustomMessage": "Unknown error while seeking content"
  },
  "id": "6388dc0cb589e"
}

solracsf avatar Dec 01 '22 16:12 solracsf

@come-nc Here is the log after making the changes.

Error PHP Error: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated at /var/www/html/lib/private/Files/Cache/Scanner.php#508   2022-12-01T18:43:57-0500
Error PHP Error: pathinfo(): Passing null to parameter #1 ($path) of type string is deprecated at /var/www/html/lib/private/Files/Cache/Scanner.php#505   2022-12-01T18:43:57-0500
Error PHP Error: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated at /var/www/html/lib/private/Files/Cache/Scanner.php#508   2022-12-01T18:43:57-0500
Error PHP Error: pathinfo(): Passing null to parameter #1 ($path) of type string is deprecated at /var/www/html/lib/private/Files/Cache/Scanner.php#505   2022-12-01T18:43:57-0500
Error PHP Error: substr(): Passing null to parameter #1 ($string) of type string is deprecated at /var/www/html/lib/private/Files/View.php#1149   2022-12-01T18:43:57-0500
Error PHP Error: pathinfo(): Passing null to parameter #1 ($path) of type string is deprecated at /var/www/html/apps/files_versions/lib/Storage.php#182   2022-12-01T18:43:57-0500
Error PHP Error: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated at /var/www/html/lib/private/Files/Cache/Scanner.php#508   2022-12-01T18:43:57-0500
Error PHP Error: pathinfo(): Passing null to parameter #1 ($path) of type string is deprecated at /var/www/html/lib/private/Files/Cache/Scanner.php#505   2022-12-01T18:43:57-0500
Error PHP Error: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated at /var/www/html/lib/private/Files/Cache/Scanner.php#508   2022-12-01T18:43:57-0500
Error PHP Error: pathinfo(): Passing null to parameter #1 ($path) of type string is deprecated at /var/www/html/lib/private/Files/Cache/Scanner.php#505   2022-12-01T18:43:57-0500
Error PHP Error: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated at /var/www/html/lib/private/Files/Cache/Scanner.php#508   2022-12-01T18:43:56-0500
Error PHP Error: pathinfo(): Passing null to parameter #1 ($path) of type string is deprecated at /var/www/html/lib/private/Files/Cache/Scanner.php#505   2022-12-01T18:43:56-0500
Error PHP Error: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated at /var/www/html/lib/private/Files/Cache/Scanner.php#508   2022-12-01T18:43:56-0500
Error PHP Error: pathinfo(): Passing null to parameter #1 ($path) of type string is deprecated at /var/www/html/lib/private/Files/Cache/Scanner.php#505   2022-12-01T18:43:56-0500
Error PHP Error: substr(): Passing null to parameter #1 ($string) of type string is deprecated at /var/www/html/lib/private/Files/View.php#1149   2022-12-01T18:43:56-0500
Error PHP Error: pathinfo(): Passing null to parameter #1 ($path) of type string is deprecated at /var/www/html/apps/files_versions/lib/Storage.php#182   2022-12-01T18:43:56-0500
Error PHP Error: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated at /var/www/html/lib/private/Files/Cache/Scanner.php#508   2022-12-01T18:43:56-0500
Error PHP Error: pathinfo(): Passing null to parameter #1 ($path) of type string is deprecated at /var/www/html/lib/private/Files/Cache/Scanner.php#505   2022-12-01T18:43:56-0500
Error PHP Error: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated at /var/www/html/lib/private/Files/Cache/Scanner.php#508   2022-12-01T18:43:56-0500
Error PHP Error: pathinfo(): Passing null to parameter #1 ($path) of type string is deprecated at /var/www/html/lib/private/Files/Cache/Scanner.php#505   2022-12-01T18:43:56-0500

Here is the trace for pathinfo error

[PHP] Error: Error: pathinfo(): Passing null to parameter #1 ($path) of type string is deprecated at /var/www/html/lib/private/Files/Cache/Scanner.php#505 at <>

  1. <> OC\Log\ErrorHandler::onError(8192, "pathinfo(): Pas ... d", "/var/www/html/l ... p", 505)
  2. /var/www/html/lib/private/Files/Cache/Scanner.php line 505 pathinfo(null, 4)
  3. /var/www/html/lib/private/Files/View.php line 1384 OC\Files\Cache\Scanner::isPartialFile(null)
  4. /var/www/html/lib/private/Files/Node/HookConnector.php line 227 OC\Files\View->getFileInfo(null)
  5. /var/www/html/lib/private/Files/Node/HookConnector.php line 113 OC\Files\Node\HookConnector->getNodeForPath(null)
  6. /var/www/html/lib/private/legacy/OC_Hook.php line 106 OC\Files\Node\HookConnector->postWrite([null])
  7. /var/www/html/apps/dav/lib/Connector/Sabre/File.php line 471 OC_Hook::emit("OC_Filesystem", "post_write", [null])
  8. /var/www/html/apps/dav/lib/Connector/Sabre/File.php line 398 OCA\DAV\Connector\Sabre\File->emitPostHooks(false)
  9. /var/www/html/apps/dav/lib/Connector/Sabre/Directory.php line 151 OCA\DAV\Connector\Sabre\File->put(null)
  10. /var/www/html/apps/dav/lib/Upload/UploadFolder.php line 45 OCA\DAV\Connector\Sabre\Directory->createFile("10485760", null)
  11. /var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php line 1098 OCA\DAV\Upload\UploadFolder->createFile("10485760", null)
  12. /var/www/html/3rdparty/sabre/dav/lib/DAV/CorePlugin.php line 504 Sabre\DAV\Server->createFile("uploads/bmw/web ... 0", null, null)
  13. /var/www/html/3rdparty/sabre/event/lib/WildcardEmitterTrait.php line 89 Sabre\DAV\CorePlugin->httpPut(Sabre\HTTP\Request {}, Sabre\HTTP\Response {})
  14. /var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php line 472 Sabre\DAV\Server->emit("method:PUT", [Sabre\HTTP\Requ ... }])
  15. /var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php line 253 Sabre\DAV\Server->invokeMethod(Sabre\HTTP\Request {}, Sabre\HTTP\Response {})
  16. /var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php line 321 Sabre\DAV\Server->start()
  17. /var/www/html/apps/dav/lib/Server.php line 360 Sabre\DAV\Server->exec()
  18. /var/www/html/apps/dav/appinfo/v2/remote.php line 35 OCA\DAV\Server->exec()
  19. /var/www/html/remote.php line 171 require_once("/var/www/html/a ... p")

PUT /remote.php/dav/uploads/bmw/web-file-upload-4e3f4bc7309fd7066264554add9843b1-1669938230502/10485760 from xxx.xxx.xxx.xxx by xxx at 2022-12-01T23:43:57+00:00

killerb77 avatar Dec 01 '22 23:12 killerb77

@killerb77 Can you try applying the following patch:

diff --git a/apps/dav/lib/Connector/Sabre/File.php b/apps/dav/lib/Connector/Sabre/File.php
index 94632b265db..a70cbcf6b01 100644
--- a/apps/dav/lib/Connector/Sabre/File.php
+++ b/apps/dav/lib/Connector/Sabre/File.php
@@ -458,6 +458,16 @@ class File extends Node implements IFile {
                        $path = $this->path;
                }
                $hookPath = Filesystem::getView()->getRelativePath($this->fileView->getAbsolutePath($path));
+               if ($hookPath === null) {
+                       \OC::$server->get(LoggerInterface::class)->error(
+                               'Triggering post hook on null path, path is {path}, absolutePath is {absolutePath}',
+                               [
+                                       'path' => $path,
+                                       'hookPath' => $hookPath,
+                                       'absolutePath' => $this->fileView->getAbsolutePath($path),
+                               ]
+                       );
+               }
                if (!$exists) {
                        \OC_Hook::emit(\OC\Files\Filesystem::CLASSNAME, \OC\Files\Filesystem::signal_post_create, [
                                \OC\Files\Filesystem::signal_param_path => $hookPath

You should get new error logs starting with «Triggering post hook on null path».

come-nc avatar Dec 05 '22 14:12 come-nc

@come-nc There are a couple of errors in the log referring to Triggering post hook on null path. I replaced my ip address with x's.

[no app in context] Error: Triggering post hook on null path, path is /web-file-upload-4e3f4bc7309fd7066264554add9843b1-1670282644964/10485760, absolutePath is /bmw/uploads/web-file-upload-4e3f4bc7309fd7066264554add9843b1-1670282644964/10485760

PUT /remote.php/dav/uploads/bmw/web-file-upload-4e3f4bc7309fd7066264554add9843b1-1670282644964/10485760 from xxx.xxx.xxx.xxx by bmw at 2022-12-05T23:24:13+00:00

[no app in context] Error: Triggering post hook on null path, path is /web-file-upload-4e3f4bc7309fd7066264554add9843b1-1670282644964/0, absolutePath is /bmw/uploads/web-file-upload-4e3f4bc7309fd7066264554add9843b1-1670282644964/0

PUT /remote.php/dav/uploads/bmw/web-file-upload-4e3f4bc7309fd7066264554add9843b1-1670282644964/0 from xxx.xxx.xxx.xxx by bmw at 2022-12-05T23:24:10+00:00

Screenshot 2022-12-05 183052

killerb77 avatar Dec 05 '22 23:12 killerb77

@come-nc same here after applying patch.

{
  "reqId": "2haKvYjpTfr6x4gBdgi5",
  "level": 3,
  "time": "2022-12-06T17:42:54+01:00",
  "app": "no app in context",
  "method": "PUT",
  "url": "/remote.php/dav/uploads/username/7e7988e2035558ee4452844e6dd363e9/0000000000000000-0000000001938191",
  "message": "Triggering post hook on null path, path is /7e7988e2035558ee4452844e6dd363e9/0000000000000000-0000000001938191, absolutePath is /username/uploads/7e7988e2035558ee4452844e6dd363e9/0000000000000000-0000000001938191",
  "userAgent": "Mozilla/5.0 (Android) Nextcloud-android/3.23.0",
  "version": "25.0.1.1",
  "data": {
    "hookPath": "null"
  },
  "id": "638fc405e3ff7"
}

or

{
  "reqId": "LKiVi55XsRQkhJDwrk5a",
  "level": 3,
  "time": "2022-12-06T15:11:39+01:00",
  "app": "no app in context",
  "method": "PUT",
  "url": "/remote.php/dav/uploads/username/65d03fbdd2745f3bbb1524faa5827705/0000000000000000-0000000009053562",
  "message": "Triggering post hook on null path, path is /65d03fbdd2745f3bbb1524faa5827705/0000000000000000-0000000009053562, absolutePath is /username/uploads/65d03fbdd2745f3bbb1524faa5827705/0000000000000000-0000000009053562",
  "userAgent": "Mozilla/5.0 (Android) Nextcloud-android/3.23.0",
  "version": "25.0.1.1",
  "data": {
    "hookPath": "null"
  },
  "id": "638fc405e80a4"
}

solracsf avatar Dec 06 '22 22:12 solracsf

@szaimen this is not a 25 (only) issue.... This is a longtime (maybe ever?) issue only popped-out by PHP8.1 deprecation warnings...

Proof here:

{
  "reqId": "uTmaeig2NKuILdjweKxe",
  "level": 3,
  "time": "2022-12-07T14:16:22+01:00",
  "user": "jbrunet",
  "app": "PHP",
  "method": "PUT",
  "url": "/remote.php/dav/uploads/jbrunet/930065050/0000000000000010",
  "message": "pathinfo(): Passing null to parameter #1 ($path) of type string is deprecated at /var/www/nextcloud/lib/private/Files/Cache/Scanner.php#499",
  "userAgent": "Mozilla/5.0 (Windows) mirall/3.6.2stable-Win64 (build 20221110) (Nextcloud, windows-10.0.22621 ClientArchitecture: x86_64 OsArchitecture: x86_64)",
  "version": "24.0.7.1",
  "exception": {
    "Exception": "Error",
    "Message": "pathinfo(): Passing null to parameter #1 ($path) of type string is deprecated at /var/www/nextcloud/lib/private/Files/Cache/Scanner.php#499",
    "Code": 0,
    "Trace": [
      {
        "function": "onError",
        "class": "OC\\Log\\ErrorHandler",
        "type": "::",
        "args": [
          8192,
          "pathinfo(): Passing null to parameter #1 ($path) of type string is deprecated",
          "/var/www/nextcloud/lib/private/Files/Cache/Scanner.php",
          499
        ]
      },
      {
        "file": "/var/www/nextcloud/lib/private/Files/Cache/Scanner.php",
        "line": 499,
        "function": "pathinfo",
        "args": [
          null,
          4
        ]
      },
      {
        "file": "/var/www/nextcloud/lib/private/Files/View.php",
        "line": 1390,
        "function": "isPartialFile",
        "class": "OC\\Files\\Cache\\Scanner",
        "type": "::",
        "args": [
          null
        ]
      },
      {
        "file": "/var/www/nextcloud/lib/private/Files/Node/HookConnector.php",
        "line": 227,
        "function": "getFileInfo",
        "class": "OC\\Files\\View",
        "type": "->",
        "args": [
          null
        ]
      },
      {
        "file": "/var/www/nextcloud/lib/private/Files/Node/HookConnector.php",
        "line": 113,
        "function": "getNodeForPath",
        "class": "OC\\Files\\Node\\HookConnector",
        "type": "->",
        "args": [
          null
        ]
      },
      {
        "file": "/var/www/nextcloud/lib/private/legacy/OC_Hook.php",
        "line": 106,
        "function": "postWrite",
        "class": "OC\\Files\\Node\\HookConnector",
        "type": "->",
        "args": [
          [
            null
          ]
        ]
      },
      {
        "file": "/var/www/nextcloud/apps/dav/lib/Connector/Sabre/File.php",
        "line": 472,
        "function": "emit",
        "class": "OC_Hook",
        "type": "::",
        "args": [
          "OC_Filesystem",
          "post_write",
          [
            null
          ]
        ]
      },
      {
        "file": "/var/www/nextcloud/apps/dav/lib/Connector/Sabre/File.php",
        "line": 399,
        "function": "emitPostHooks",
        "class": "OCA\\DAV\\Connector\\Sabre\\File",
        "type": "->",
        "args": [
          false
        ]
      },
      {
        "file": "/var/www/nextcloud/apps/dav/lib/Connector/Sabre/Directory.php",
        "line": 164,
        "function": "put",
        "class": "OCA\\DAV\\Connector\\Sabre\\File",
        "type": "->",
        "args": [
          null
        ]
      },
      {
        "file": "/var/www/nextcloud/apps/dav/lib/Upload/UploadFolder.php",
        "line": 45,
        "function": "createFile",
        "class": "OCA\\DAV\\Connector\\Sabre\\Directory",
        "type": "->",
        "args": [
          "0000000000000010",
          null
        ]
      },
      {
        "file": "/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php",
        "line": 1098,
        "function": "createFile",
        "class": "OCA\\DAV\\Upload\\UploadFolder",
        "type": "->",
        "args": [
          "0000000000000010",
          null
        ]
      },
      {
        "file": "/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php",
        "line": 504,
        "function": "createFile",
        "class": "Sabre\\DAV\\Server",
        "type": "->",
        "args": [
          "uploads/jbrunet/930065050/0000000000000010",
          null,
          null
        ]
      },
      {
        "file": "/var/www/nextcloud/3rdparty/sabre/event/lib/WildcardEmitterTrait.php",
        "line": 89,
        "function": "httpPut",
        "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:PUT",
          [
            {
              "__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": "6390935440b42"
}

solracsf avatar Dec 07 '22 13:12 solracsf

@killerb77 "bmw" is a user id? Is it the one of the user uploading the file? Is the operation an upload into a shared folder or some special case like this?

come-nc avatar Dec 08 '22 08:12 come-nc

@come-nc "bmw" is a Nextcloud user id. Yes, it's the user that is uploading the file. "bmw" is also a user on the server. Also, since Nextcloud is running in docker, I have my docker compose file and static files in user bmw home directory. home/bmw/nextcloud25.

No, I am not uploading into a shared folder.

killerb77 avatar Dec 08 '22 11:12 killerb77

@come-nc Any updates on this?

killerb77 avatar Dec 25 '22 15:12 killerb77

I am able to reproduce this.

It’s when chunk uploading a big file I think, the file is in uploads folder, and it tries to trigger hook on this path, which fails because it’s not relative to files/ folder. We should either disable hooks on this uploads folder, or fix them to handle paths outside of files.

come-nc avatar Jan 02 '23 15:01 come-nc

What do you call big files? On my side files not bigger than 10Mb triggers this. Sometimes. Sometimes don't...

solracsf avatar Jan 02 '23 19:01 solracsf

I meant any file that is uploaded by chunks, but maybe any file goes through the uploads folder, not sure.

come-nc avatar Jan 03 '23 07:01 come-nc

I am also having this issue. I am on the latest version.

tram98 avatar Feb 19 '23 15:02 tram98

Using nextcloud:fpm official docker image (25.0.1). I am getting the same error in log. I believe it is related to chunk uploads (Files larger than 10MB).

I tried modifying /var/www/html/lib/private/Files/Cache/Scanner.php (line 508) to cast the $file as empty string than null but then got more errors in substr(): Passing null to parameter #1 ($string) of type string is deprecated at /var/www/html/lib/private/Files/View.php#1149"

Reverted back to original code, then tried per documentation setting max chunk size to 0 from within container as www-data

php occ config:app:set files max_chunk_size --value 0

that didn't work too.

Has anyone figured out a solution for this?

yehiashouman avatar Feb 22 '23 15:02 yehiashouman

upgrading docker image (pulling, removing old image, building, starting) to latest (25.0.3) didn't fix it.

yehiashouman avatar Feb 22 '23 16:02 yehiashouman

I keep getting this error when uploading folders with more than a few files in them. It results in one or two files not uploading, which is hugely time-consuming as I need to go and find which folders have files missing afterwards.

{"Exception":"Error","Message":"strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated at /var/www/nextcloud/lib/private/Files/Cache/Scanner.php#508","Code":0,"Trace":[{"function":"onError","class":"OC\\Log\\ErrorHandler","type":"::"},{"file":"/var/www/nextcloud/lib/private/Files/Cache/Scanner.php","line":508,"function":"strpos"},{"file":"/var/www/nextcloud/lib/private/Files/View.php","line":1384,"function":"isPartialFile","class":"OC\\Files\\Cache\\Scanner","type":"::"},{"file":"/var/www/nextcloud/lib/private/Files/Node/HookConnector.php","line":227,"function":"getFileInfo","class":"OC\\Files\\View","type":"->"},{"file":"/var/www/nextcloud/lib/private/Files/Node/HookConnector.php","line":113,"function":"getNodeForPath","class":"OC\\Files\\Node\\HookConnector","type":"->"},{"file":"/var/www/nextcloud/lib/private/legacy/OC_Hook.php","line":106,"function":"postWrite","class":"OC\\Files\\Node\\HookConnector","type":"->"},{"file":"/var/www/nextcloud/apps/dav/lib/Connector/Sabre/File.php","line":471,"function":"emit","class":"OC_Hook","type":"::"},{"file":"/var/www/nextcloud/apps/dav/lib/Connector/Sabre/File.php","line":398,"function":"emitPostHooks","class":"OCA\\DAV\\Connector\\Sabre\\File","type":"->"},{"file":"/var/www/nextcloud/apps/dav/lib/Connector/Sabre/Directory.php","line":151,"function":"put","class":"OCA\\DAV\\Connector\\Sabre\\File","type":"->"},{"file":"/var/www/nextcloud/apps/dav/lib/Upload/UploadFolder.php","line":45,"function":"createFile","class":"OCA\\DAV\\Connector\\Sabre\\Directory","type":"->"},{"file":"/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":1098,"function":"createFile","class":"OCA\\DAV\\Upload\\UploadFolder","type":"->"},{"file":"/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php","line":504,"function":"createFile","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/nextcloud/3rdparty/sabre/event/lib/WildcardEmitterTrait.php","line":89,"function":"httpPut","class":"Sabre\\DAV\\CorePlugin","type":"->"},{"file":"/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":472,"function":"emit","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":253,"function":"invokeMethod","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":321,"function":"start","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/nextcloud/apps/dav/lib/Server.php","line":360,"function":"exec","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/nextcloud/apps/dav/appinfo/v2/remote.php","line":35,"function":"exec","class":"OCA\\DAV\\Server","type":"->"},{"file":"/var/www/nextcloud/remote.php","line":171,"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":"--"}}

Is this the same error as the one described here?

dinosmm avatar Mar 17 '23 17:03 dinosmm

There is an ongoing patch (WiP) so stay tuned and follow it (subscribe) if needed. https://github.com/nextcloud/server/pull/36893

solracsf avatar Mar 17 '23 21:03 solracsf