From: Joas Schilling Date: Tue, 25 Feb 2020 08:44:58 +0000 (+0100) Subject: Correctly trim long cyrillic note X-Git-Tag: v18.0.2RC1~24^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=refs%2Fpull%2F19636%2Fhead;p=nextcloud-server.git Correctly trim long cyrillic note Signed-off-by: Joas Schilling --- diff --git a/apps/dav/lib/CalDAV/CalDavBackend.php b/apps/dav/lib/CalDAV/CalDavBackend.php index 237c604f661..37dbb3c3f5d 100644 --- a/apps/dav/lib/CalDAV/CalDavBackend.php +++ b/apps/dav/lib/CalDAV/CalDavBackend.php @@ -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(); } } diff --git a/apps/dav/lib/CardDAV/CardDavBackend.php b/apps/dav/lib/CardDAV/CardDavBackend.php index 7ade5b7959c..24b91f7cec3 100644 --- a/apps/dav/lib/CardDAV/CardDavBackend.php +++ b/apps/dav/lib/CardDAV/CardDavBackend.php @@ -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(); }