diff --git a/lib/private/Comments/Comment.php b/lib/private/Comments/Comment.php
index c838e9571c6b73815caf45d2d4caa10878eb7729..e2d32e74850478d530d987f8a9ebbfd01b68138c 100644
--- a/lib/private/Comments/Comment.php
+++ b/lib/private/Comments/Comment.php
@@ -233,7 +233,9 @@ class Comment implements IComment {
 			return [];
 		}
 		$uids = array_unique($mentions[0]);
-		usort($uids, 'mb_strlen');
+		usort($uids, static function($uid1, $uid2) {
+			return mb_strlen($uid2) <=> mb_strlen($uid1);
+		});
 		$result = [];
 		foreach ($uids as $uid) {
 			$cleanUid = trim(substr($uid, 1), '"');