Skip to content

[Bug]: PHP8.1 - DateTime::createFromFormat(): Passing null to parameter #2 ($datetime) of type string is deprecated at /apps/sharebymail/lib/ShareByMailProvider.php#1046 #35128

@solracsf

Description

@solracsf

⚠️ This issue respects the following points: ⚠️

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

Bug description

See logged error.

Steps to reproduce

N/A

Expected behavior

PHP 8.1 compatibility.

Installation method

No response

Operating system

No response

PHP engine version

PHP 8.1

Web server

No response

Database engine version

No response

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

Updated to a major version (ex. 22.2.3 to 23.0.1)

Are you using the Nextcloud Server Encryption module?

No response

What user-backends are you using?

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

Configuration report

No response

List of activated Apps

N/A

Nextcloud Signing status

No response

Nextcloud Logs

{
  "reqId": "PbXJfvMrQrRtcawGgwKW",
  "level": 3,
  "time": "2022-11-13T18:01:39+00:00",
  "remoteAddr": "86.201.108.140",
  "user": "******",
  "app": "PHP",
  "method": "GET",
  "url": "/ocs/v2.php/apps/files_sharing/api/v1/sharees_recommended?format=json&itemType=dir",
  "message": "DateTime::createFromFormat(): Passing null to parameter #2 ($datetime) of type string is deprecated at /var/www/nextcloud/apps/sharebymail/lib/ShareByMailProvider.php#1046",
  "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": "DateTime::createFromFormat(): Passing null to parameter #2 ($datetime) of type string is deprecated at /var/www/nextcloud/apps/sharebymail/lib/ShareByMailProvider.php#1046",
    "Code": 0,
    "Trace": [
      {
        "function": "onError",
        "class": "OC\\Log\\ErrorHandler",
        "type": "::",
        "args": [
          8192,
          "DateTime::createFromFormat(): Passing null to parameter #2 ($datetime) of type string is deprecated",
          "/var/www/nextcloud/apps/sharebymail/lib/ShareByMailProvider.php",
          1046
        ]
      },
      {
        "file": "/var/www/nextcloud/apps/sharebymail/lib/ShareByMailProvider.php",
        "line": 1046,
        "function": "createFromFormat",
        "class": "DateTime",
        "type": "::",
        "args": [
          "Y-m-d H:i:s",
          null
        ]
      },
      {
        "file": "/var/www/nextcloud/apps/sharebymail/lib/ShareByMailProvider.php",
        "line": 881,
        "function": "createShareObject",
        "class": "OCA\\ShareByMail\\ShareByMailProvider",
        "type": "->",
        "args": [
          [
            37604,
            4,
            "******",
            null,
            "******",
            "And 20 more entries, set log level to debug to see all entries"
          ]
        ]
      },
      {
        "file": "/var/www/nextcloud/lib/private/Share20/Manager.php",
        "line": 1339,
        "function": "getSharesBy",
        "class": "OCA\\ShareByMail\\ShareByMailProvider",
        "type": "->",
        "args": [
          "******",
          4,
          null,
          false,
          50,
          0
        ]
      },
      {
        "file": "/var/www/nextcloud/apps/files_sharing/lib/Controller/ShareesAPIController.php",
        "line": 260,
        "function": "getSharesBy",
        "class": "OC\\Share20\\Manager",
        "type": "->",
        "args": [
          "******",
          4,
          null,
          false,
          50,
          0
        ]
      },
      {
        "file": "/var/www/nextcloud/apps/files_sharing/lib/Controller/ShareesAPIController.php",
        "line": 295,
        "function": "getAllShareesByType",
        "class": "OCA\\Files_Sharing\\Controller\\ShareesAPIController",
        "type": "->",
        "args": [
          "******",
          4
        ]
      },
      {
        "file": "/var/www/nextcloud/apps/files_sharing/lib/Controller/ShareesAPIController.php",
        "line": 387,
        "function": "getAllSharees",
        "class": "OCA\\Files_Sharing\\Controller\\ShareesAPIController",
        "type": "->",
        "args": [
          "******",
          [
            0,
            1,
            4
          ]
        ]
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 225,
        "function": "findRecommended",
        "class": "OCA\\Files_Sharing\\Controller\\ShareesAPIController",
        "type": "->",
        "args": [
          "dir",
          null
        ]
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 133,
        "function": "executeController",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->",
        "args": [
          {
            "__class__": "OCA\\Files_Sharing\\Controller\\ShareesAPIController"
          },
          "findRecommended"
        ]
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/App.php",
        "line": 172,
        "function": "dispatch",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->",
        "args": [
          {
            "__class__": "OCA\\Files_Sharing\\Controller\\ShareesAPIController"
          },
          "findRecommended"
        ]
      },
      {
        "file": "/var/www/nextcloud/lib/private/Route/Router.php",
        "line": 298,
        "function": "main",
        "class": "OC\\AppFramework\\App",
        "type": "::",
        "args": [
          "OCA\\Files_Sharing\\Controller\\ShareesAPIController",
          "findRecommended",
          {
            "__class__": "OC\\AppFramework\\DependencyInjection\\DIContainer"
          },
          [
            "ocs.files_sharing.ShareesAPI.findRecommended"
          ]
        ]
      },
      {
        "file": "/var/www/nextcloud/ocs/v1.php",
        "line": 62,
        "function": "match",
        "class": "OC\\Route\\Router",
        "type": "->",
        "args": [
          "/ocsapp/apps/files_sharing/api/v1/sharees_recommended"
        ]
      },
      {
        "file": "/var/www/nextcloud/ocs/v2.php",
        "line": 23,
        "args": [
          "/var/www/nextcloud/ocs/v1.php"
        ],
        "function": "require_once"
      }
    ],
    "File": "/var/www/nextcloud/lib/private/Log/ErrorHandler.php",
    "Line": 92,
    "CustomMessage": "--"
  },
  "id": "63713168c6551"
}

Additional info

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions