From 079852bdce00b0fcf2abaa802e1b5dc8fa48ce1a Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Sun, 9 Dec 2018 13:52:31 +0100 Subject: [PATCH] * Api: truncate varchar for all DB types now, as MariaDB 10.3 also errors on to big content --- api/src/Db.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/api/src/Db.php b/api/src/Db.php index 513b0ef72e..52bee58e34 100644 --- a/api/src/Db.php +++ b/api/src/Db.php @@ -1483,9 +1483,8 @@ class Db { $value = implode($glue,$value); } - // only truncate string if length given and <= 255 - // to not unnecessary truncate varchar(>255) as PostgreSQL uses text anyway and MySQL truncates itself silently (unless strict mode!) - if (!is_null($length) && $length <= 255 && mb_strlen($value) > $length) + // truncate to long strings for varchar(X) columns as PostgreSQL and newer MySQL/MariaDB given an error otherwise + if (!is_null($length) && mb_strlen($value) > $length) { $value = mb_substr($value, 0, $length); }