Merge pull request #26755 from yan12125/bugfix/yan12125/caldav-truncation
Correctly truncate multibyte strings to fit into the database
This commit is contained in:
commit
8f3a0705d4
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1271,7 +1271,7 @@ class CardDavBackend implements BackendInterface, SyncSupport {
|
|||
}
|
||||
}
|
||||
$query->setParameter('name', $property->name);
|
||||
$query->setParameter('value', mb_substr($property->getValue(), 0, 254));
|
||||
$query->setParameter('value', mb_strcut($property->getValue(), 0, 254));
|
||||
$query->setParameter('preferred', $preferred);
|
||||
$query->execute();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue