Merge pull request #9097 from nextcloud/bugfix/7661/use_mb_substr

Use multibyte substring
This commit is contained in:
Julius Härtl 2018-04-11 15:55:55 +02:00 committed by GitHub
commit 2626d11f78
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2251,7 +2251,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 = substr($value, 0, 254);
$value = mb_substr($value, 0, 254);
$query->setParameter('name', $property->name);
$query->setParameter('parameter', null);
@ -2269,7 +2269,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 = substr($value, 0, 254);
$value = mb_substr($value, 0, 254);
$query->setParameter('name', $property->name);
$query->setParameter('parameter', substr($key, 0, 254));