From 998144f832cb6f78f20b8cdc7e1c6bde379f9522 Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Fri, 26 Nov 2021 16:30:14 +0100 Subject: Obey col length of 255 to insert and search in accounts_data Signed-off-by: Arthur Schiwon --- lib/private/Accounts/AccountManager.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/private/Accounts/AccountManager.php b/lib/private/Accounts/AccountManager.php index cbd51e71c4a..2c7641243fa 100644 --- a/lib/private/Accounts/AccountManager.php +++ b/lib/private/Accounts/AccountManager.php @@ -343,6 +343,10 @@ class AccountManager implements IAccountManager { } public function searchUsers(string $property, array $values): array { + // the value col is limited to 255 bytes. It is used for searches only. + $values = array_map(function (string $value) { + return Util::shortenMultibyteString($value, 255); + }, $values); $chunks = array_chunk($values, 500); $query = $this->connection->getQueryBuilder(); $query->select('*') @@ -625,8 +629,11 @@ class AccountManager implements IAccountManager { continue; } + // the value col is limited to 255 bytes. It is used for searches only. + $value = $property['value'] ? Util::shortenMultibyteString($property['value'], 255) : ''; + $query->setParameter('name', $property['name']) - ->setParameter('value', $property['value'] ?? ''); + ->setParameter('value', $value); $query->executeStatement(); } } -- cgit v1.2.3