diff --git a/Modules/Chatroom/classes/class.ilChatroom.php b/Modules/Chatroom/classes/class.ilChatroom.php index 35948fcf32f7..b1d58cf5a582 100644 --- a/Modules/Chatroom/classes/class.ilChatroom.php +++ b/Modules/Chatroom/classes/class.ilChatroom.php @@ -823,8 +823,8 @@ public function getLastMessages(int $number, ilChatroomUser $chatuser): array } usort($results, static function (stdClass $a, stdClass $b): int { - $a_timestamp = strlen((string) $a->timestamp) === 13 ? ((int) substr($a->timestamp, 0, -3)) : $a->timestamp; - $b_timestamp = strlen((string) $b->timestamp) === 13 ? ((int) substr($b->timestamp, 0, -3)) : $b->timestamp; + $a_timestamp = strlen((string) $a->timestamp) === 13 ? ((int) substr((string) $a->timestamp, 0, -3)) : $a->timestamp; + $b_timestamp = strlen((string) $b->timestamp) === 13 ? ((int) substr((string) $b->timestamp, 0, -3)) : $b->timestamp; return $b_timestamp - $a_timestamp; });