Skip to content

OCA\\Talk\\Model\\Thread::fromJson(): Argument #1 ($json) must be of type string, array givenΒ #16921

@SystemKeeper

Description

@SystemKeeper

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.

For easier reproduction, comment the following lines:

$row = $this->cache->get(self::CACHE_PREFIX . $roomId . '/' . $potentialThreadId);
if (!empty($row)) {
return true;
}
if ($row === '') {
return false;
}

Steps to reproduce

  1. Enter a thread and write a message
  2. Now try to schedule a message

Actual behaviour

OCA\\Talk\\Model\\Thread::fromJson(): Argument #1 ($json) must be of type string, array given

We set the $row as cache value at

$this->cache->set(self::CACHE_PREFIX . $roomId . '/' . $potentialThreadId, $row, 60 * 15);

but in all other cases, it's a json string, e.g. at

$this->cache->set(self::CACHE_PREFIX . $thread->getRoomId() . '/' . $thread->getId(), $thread->toJson(), 60 * 15);

So depending on where the cache entry was created, we crash at

$row = $this->cache->get(self::CACHE_PREFIX . $roomId . '/' . $threadId);
if (!empty($row)) {
return Thread::fromJson($row);
}

Metadata

Metadata

Assignees

Type

No type

Projects

Status

🧭 Planning evaluation (don't pick)

Relationships

None yet

Development

No branches or pull requests

Issue actions