Skip to content

Commit 107c7d2

Browse files
committed
Merge branch 'github-pr17' into 'master'
fix: Utf8_truncate crashes on empty strings due to off-by-one-error See merge request grommunio/grommunio-sync!101
2 parents c7163ac + d27d54e commit 107c7d2

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/utils/utils.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,11 @@ public static function GetTruncSize($truncation) {
335335
* @return string truncated string
336336
*/
337337
public static function Utf8_truncate($string, $length, $htmlsafe = false) {
338+
// skip empty strings
339+
if (empty($string)) {
340+
return "";
341+
}
342+
338343
// make sure length is always an integer
339344
$length = (int) $length;
340345

0 commit comments

Comments
 (0)