Merge pull request #19636 from nextcloud/backport/19634/stable18

[stable18] Correctly trim long cyrillic note
This commit is contained in:
Roeland Jago Douma 2020-02-25 20:31:09 +01:00 committed by GitHub
commit 0b71df0ed0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 4 deletions

View file

@ -2465,11 +2465,10 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
if ($this->db->supports4ByteText()) {
$value = preg_replace('/[\x{10000}-\x{10FFFF}]/u', "\xEF\xBF\xBD", $value);
}
$value = mb_substr($value, 0, 254);
$query->setParameter('name', $property->name);
$query->setParameter('parameter', substr($key, 0, 254));
$query->setParameter('value', substr($value, 0, 254));
$query->setParameter('parameter', mb_substr($key, 0, 254));
$query->setParameter('value', mb_substr($value, 0, 254));
$query->execute();
}
}

View file

@ -1063,7 +1063,7 @@ class CardDavBackend implements BackendInterface, SyncSupport {
}
}
$query->setParameter('name', $property->name);
$query->setParameter('value', substr($property->getValue(), 0, 254));
$query->setParameter('value', mb_substr($property->getValue(), 0, 254));
$query->setParameter('preferred', $preferred);
$query->execute();
}