summaryrefslogtreecommitdiffstats
path: root/apps/dav/lib/CalDAV/CalDavBackend.php
diff options
context:
space:
mode:
authorChih-Hsuan Yen <yan12125@gmail.com>2021-04-26 16:05:50 +0800
committerChih-Hsuan Yen <yan12125@gmail.com>2021-04-26 16:54:50 +0800
commitfea5b4a8b9dc829aa8a53a208d60c30ed7096601 (patch)
tree6b1a1afa35e125bed293ce9cd4f25abd4a7f64ca /apps/dav/lib/CalDAV/CalDavBackend.php
parentbf9ed2d3cd9a50ad5320b3fb07cbeac7ee4241b6 (diff)
downloadnextcloud-server-fea5b4a8b9dc829aa8a53a208d60c30ed7096601.tar.gz
nextcloud-server-fea5b4a8b9dc829aa8a53a208d60c30ed7096601.zip
Correctly truncate multibyte strings to fit into the database
Closes: #26174 Signed-off-by: Chih-Hsuan Yen <yan12125@gmail.com>
Diffstat (limited to 'apps/dav/lib/CalDAV/CalDavBackend.php')
-rw-r--r--apps/dav/lib/CalDAV/CalDavBackend.php6
1 files changed, 3 insertions, 3 deletions
diff --git a/apps/dav/lib/CalDAV/CalDavBackend.php b/apps/dav/lib/CalDAV/CalDavBackend.php
index 15dabdbb14e..0a57ce17454 100644
--- a/apps/dav/lib/CalDAV/CalDavBackend.php
+++ b/apps/dav/lib/CalDAV/CalDavBackend.php
@@ -2678,7 +2678,7 @@ 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);
+ $value = mb_strcut($value, 0, 254);
$query->setParameter('name', $property->name);
$query->setParameter('parameter', null);
@@ -2698,8 +2698,8 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
}
$query->setParameter('name', $property->name);
- $query->setParameter('parameter', mb_substr($key, 0, 254));
- $query->setParameter('value', mb_substr($value, 0, 254));
+ $query->setParameter('parameter', mb_strcut($key, 0, 254));
+ $query->setParameter('value', mb_strcut($value, 0, 254));
$query->executeUpdate();
}
}