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

PHP8.1 - json_decode(): Passing null to parameter #1 ($json) of type string is deprecated #8311

Closed
solracsf opened this issue Nov 7, 2022 · 7 comments
Assignees
Labels
1. to develop bug feature: api 🛠️ OCS API for conversations, chats and participants feature: reactions 👍
Milestone

Comments

@solracsf
Copy link
Member

solracsf commented Nov 7, 2022

How to use GitHub

  • Please use the 👍 reaction to show that you are affected by the same issue.
  • Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
  • Subscribe to receive notifications on status change and new comments.

Not sure if this should be fixed here or on server by avoiding parsing null, but reporting here anyway.
NC 24.0.7 and Spreed 14.0.6 on PHP 8.1

{
  "reqId": "87Pc2n5s3an7LKdQUw6P",
  "level": 3,
  "time": "2022-11-07T17:56:59+01:00",
  "remoteAddr": "90.30.85.149",
  "user": "zfefz",
  "app": "PHP",
  "method": "GET",
  "url": "/ocs/v2.php/apps/spreed/api/v4/room?includeStatus=true",
  "message": "json_decode(): Passing null to parameter #1 ($json) of type string is deprecated at /var/www/nextcloud/lib/private/Comments/Manager.php#112",
  "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:106.0) Gecko/20100101 Firefox/106.0",
  "version": "24.0.7.1",
  "exception": {
    "Exception": "Error",
    "Message": "json_decode(): Passing null to parameter #1 ($json) of type string is deprecated at /var/www/nextcloud/lib/private/Comments/Manager.php#112",
    "Code": 0,
    "Trace": [
      {
        "function": "onError",
        "class": "OC\\Log\\ErrorHandler",
        "type": "::",
        "args": [
          8192,
          "json_decode(): Passing null to parameter #1 ($json) of type string is deprecated",
          "/var/www/nextcloud/lib/private/Comments/Manager.php",
          112
        ]
      },
      {
        "file": "/var/www/nextcloud/lib/private/Comments/Manager.php",
        "line": 112,
        "function": "json_decode",
        "args": [
          null,
          true
        ]
      },
      {
        "file": "/var/www/nextcloud/apps/spreed/lib/Chat/CommentsManager.php",
        "line": 40,
        "function": "normalizeDatabaseData",
        "class": "OC\\Comments\\Manager",
        "type": "->",
        "args": [
          [
            "39908",
            "0",
            "0",
            0,
            "comment",
            "And 8 more entries, set log level to debug to see all entries"
          ]
        ]
      },
      {
        "file": "/var/www/nextcloud/apps/spreed/lib/Manager.php",
        "line": 221,
        "function": "getCommentFromData",
        "class": "OCA\\Talk\\Chat\\CommentsManager",
        "type": "->",
        "args": [
          [
            39908,
            0,
            0,
            0,
            "comment",
            "And 8 more entries, set log level to debug to see all entries"
          ]
        ]
      },
      {
        "file": "/var/www/nextcloud/apps/spreed/lib/Manager.php",
        "line": 148,
        "function": "createCommentObject",
        "class": "OCA\\Talk\\Manager",
        "type": "->",
        "args": [
          [
            2,
            0,
            0,
            0,
            null,
            "And 55 more entries, set log level to debug to see all entries"
          ]
        ]
      },
      {
        "file": "/var/www/nextcloud/apps/spreed/lib/Manager.php",
        "line": 339,
        "function": "createRoomObject",
        "class": "OCA\\Talk\\Manager",
        "type": "->",
        "args": [
          [
            2,
            0,
            0,
            0,
            null,
            "And 55 more entries, set log level to debug to see all entries"
          ]
        ]
      },
      {
        "file": "/var/www/nextcloud/apps/spreed/lib/Manager.php",
        "line": 296,
        "function": "getRoomsForActor",
        "class": "OCA\\Talk\\Manager",
        "type": "->",
        "args": [
          "users",
          "zfefz",
          [
            "zShaOjrriVNNSUQ5RXcu+orvmBoxBKbhM3mj8VbqWYi2PtSypL59jhx05jqzmDJCRsuIH63nM7PoOHbi8bd5ng4+d0pyux5XHl8krCapMWv2a9sbPLUNVR/xx4+Uhbqtd01t+QFkkuEnnSiIowbvMjHmCG2zkIIYB4OqiOL+EhXgd9QnnSrOlQyHoiRYJfFLiDiBfgDwmYJR4xAMgZWlrfntYjaTXOmzHfAV6TCYRBaHu+usjmakDOFnENnrPDx"
          ],
          true
        ]
      },
      {
        "file": "/var/www/nextcloud/apps/spreed/lib/Controller/RoomController.php",
        "line": 196,
        "function": "getRoomsForUser",
        "class": "OCA\\Talk\\Manager",
        "type": "->",
        "args": [
          "zfefz",
          [
            "zShaOjrriVNNSUQ5RXcu+orvmBoxBKbhM3mj8VbqWYi2PtSypL59jhx05jqzmDJCRsuIH63nM7PoOHbi8bd5ng4+d0pyux5XHl8krCapMWv2a9sbPLUNVR/xx4+Uhbqtd01t+QFkkuEnnSiIowbvMjHmCG2zkIIYB4OqiOL+EhXgd9QnnSrOlQyHoiRYJfFLiDiBfgDwmYJR4xAMgZWlrfntYjaTXOmzHfAV6TCYRBaHu+usjmakDOFnENnrPDx"
          ],
          true
        ]
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 225,
        "function": "getRooms",
        "class": "OCA\\Talk\\Controller\\RoomController",
        "type": "->",
        "args": [
          0,
          true
        ]
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 133,
        "function": "executeController",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->",
        "args": [
          {
            "__class__": "OCA\\Talk\\Controller\\RoomController"
          },
          "getRooms"
        ]
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/App.php",
        "line": 172,
        "function": "dispatch",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->",
        "args": [
          {
            "__class__": "OCA\\Talk\\Controller\\RoomController"
          },
          "getRooms"
        ]
      },
      {
        "file": "/var/www/nextcloud/lib/private/Route/Router.php",
        "line": 298,
        "function": "main",
        "class": "OC\\AppFramework\\App",
        "type": "::",
        "args": [
          "OCA\\Talk\\Controller\\RoomController",
          "getRooms",
          {
            "__class__": "OC\\AppFramework\\DependencyInjection\\DIContainer"
          },
          [
            "v4",
            "ocs.spreed.Room.getRooms"
          ]
        ]
      },
      {
        "file": "/var/www/nextcloud/ocs/v1.php",
        "line": 62,
        "function": "match",
        "class": "OC\\Route\\Router",
        "type": "->",
        "args": [
          "/ocsapp/apps/spreed/api/v4/room"
        ]
      },
      {
        "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": "--"
  }
}
@nickvergessen
Copy link
Member

Can you please include more information about your system? Which DB is being used, etc?
I mean wrapping it with a null check is easy, but it should never be null to begin with.

@solracsf
Copy link
Member Author

solracsf commented Nov 8, 2022

Sure. Vanilla install with PHP-FPM 8.1, Apache 2.4, MariaDB 10.6, Redis 7 for cache and locking, local filesystem, local DB for auth (no LDAP, SSO...). Errors popping-up after upgrade from 23 to 24.

@solracsf
Copy link
Member Author

Doesn't seem related to Talk only.
On another instance with Talk not installed:

{
  "reqId": "uo4QESiy8e6rOXolGeTo",
  "level": 3,
  "time": "2022-11-13T17:48:17+00:00",
  "app": "PHP",
  "method": "GET",
  "url": "/ocs/v2.php/apps/notifications/api/v2/notifications",
  "message": "json_decode(): Passing null to parameter #1 ($json) of type string is deprecated at /var/www/nextcloud/lib/private/Comments/Manager.php#112",
  "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36 Edg/107.0.1418.35",
  "version": "24.0.7.1",
  "exception": {
    "Exception": "Error",
    "Message": "json_decode(): Passing null to parameter #1 ($json) of type string is deprecated at /var/www/nextcloud/lib/private/Comments/Manager.php#112",
    "Code": 0,
    "Trace": [
      {
        "function": "onError",
        "class": "OC\\Log\\ErrorHandler",
        "type": "::",
        "args": [
          8192,
          "json_decode(): Passing null to parameter #1 ($json) of type string is deprecated",
          "/var/www/nextcloud/lib/private/Comments/Manager.php",
          112
        ]
      },
      {
        "file": "/var/www/nextcloud/lib/private/Comments/Manager.php",
        "line": 112,
        "function": "json_decode",
        "args": [
          null,
          true
        ]
      },
      {
        "file": "/var/www/nextcloud/lib/private/Comments/Manager.php",
        "line": 134,
        "function": "normalizeDatabaseData",
        "class": "OC\\Comments\\Manager",
        "type": "->",
        "args": [
          [
            "11",
            "0",
            "0",
            0,
            "users",
            "And 9 more entries, set log level to debug to see all entries"
          ]
        ]
      },
      {
        "file": "/var/www/nextcloud/lib/private/Comments/Manager.php",
        "line": 298,
        "function": "getCommentFromData",
        "class": "OC\\Comments\\Manager",
        "type": "->",
        "args": [
          [
            11,
            0,
            0,
            0,
            "users",
            "And 9 more entries, set log level to debug to see all entries"
          ]
        ]
      },
      {
        "file": "/var/www/nextcloud/apps/comments/lib/Notification/Notifier.php",
        "line": 94,
        "function": "get",
        "class": "OC\\Comments\\Manager",
        "type": "->",
        "args": [
          "11"
        ]
      },
      {
        "file": "/var/www/nextcloud/lib/private/Notification/Manager.php",
        "line": 376,
        "function": "prepare",
        "class": "OCA\\Comments\\Notification\\Notifier",
        "type": "->",
        "args": [
          {
            "__class__": "OC\\Notification\\Notification"
          },
          "fr"
        ]
      },
      {
        "file": "/var/www/nextcloud/apps/notifications/lib/Controller/EndpointController.php",
        "line": 111,
        "function": "prepare",
        "class": "OC\\Notification\\Manager",
        "type": "->",
        "args": [
          {
            "__class__": "OC\\Notification\\Notification"
          },
          "fr"
        ]
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 225,
        "function": "listNotifications",
        "class": "OCA\\Notifications\\Controller\\EndpointController",
        "type": "->",
        "args": [
          "v2"
        ]
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 133,
        "function": "executeController",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->",
        "args": [
          {
            "__class__": "OCA\\Notifications\\Controller\\EndpointController"
          },
          "listNotifications"
        ]
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/App.php",
        "line": 172,
        "function": "dispatch",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->",
        "args": [
          {
            "__class__": "OCA\\Notifications\\Controller\\EndpointController"
          },
          "listNotifications"
        ]
      },
      {
        "file": "/var/www/nextcloud/lib/private/Route/Router.php",
        "line": 298,
        "function": "main",
        "class": "OC\\AppFramework\\App",
        "type": "::",
        "args": [
          "OCA\\Notifications\\Controller\\EndpointController",
          "listNotifications",
          {
            "__class__": "OC\\AppFramework\\DependencyInjection\\DIContainer"
          },
          [
            "v2",
            "ocs.notifications.Endpoint.listNotifications"
          ]
        ]
      },
      {
        "file": "/var/www/nextcloud/ocs/v1.php",
        "line": 62,
        "function": "match",
        "class": "OC\\Route\\Router",
        "type": "->",
        "args": [
          "/ocsapp/apps/notifications/api/v2/notifications"
        ]
      },
      {
        "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": "63713006c06c3"
}

@solracsf solracsf changed the title json_decode(): Passing null to parameter #1 ($json) of type string is deprecated PHP8.1 - json_decode(): Passing null to parameter #1 ($json) of type string is deprecated Nov 13, 2022
@nickvergessen
Copy link
Member

Yeah it's the server component talk and comments use. But it's okay to have the ticket here.

The ticket you linked above however is totally unrelated.

@nickvergessen nickvergessen added 1. to develop feature: api 🛠️ OCS API for conversations, chats and participants feature: reactions 👍 and removed 0. Needs triage labels Nov 14, 2022
@solracsf
Copy link
Member Author

Only linked as a PHP8.1 deprecation. But not the same issue, sure.

@nickvergessen nickvergessen added this to the 💖 Next Patch (25) milestone Nov 18, 2022
@nickvergessen
Copy link
Member

Found the problem.
The backport did not work and for some reason I just removed the label:
nextcloud/server#32288 (comment)

@nickvergessen
Copy link
Member

Should be fixed by nextcloud/server#35245 so in the upcoming 24 release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1. to develop bug feature: api 🛠️ OCS API for conversations, chats and participants feature: reactions 👍
Projects
None yet
Development

No branches or pull requests

2 participants