]> source.dussan.org Git - nextcloud-server.git/commitdiff
Correctly trim long cyrillic note 19634/head
authorJoas Schilling <coding@schilljs.com>
Tue, 25 Feb 2020 08:44:58 +0000 (09:44 +0100)
committerJoas Schilling <coding@schilljs.com>
Tue, 25 Feb 2020 10:17:02 +0000 (11:17 +0100)
Signed-off-by: Joas Schilling <coding@schilljs.com>
apps/dav/lib/CalDAV/CalDavBackend.php
apps/dav/lib/CardDAV/CardDavBackend.php

index 237c604f66180bffab2a12c5964c183ed7874831..37dbb3c3f5d2424879e886d73445ee1bd267c94c 100644 (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();
                                                }
                                        }
index 7ade5b7959cf377421361da1b8f3fb4a762881da..24b91f7cec365b796363b33d929cf65f5f29d3c0 100644 (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();
                }