From fc3dccd17e0a59a6a8fdfa360219d2d3febea57f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Tue, 10 Dec 2013 22:06:24 +0100 Subject: [PATCH] Remove 4 byte utf-8 characters in MessageUtil::stripCrap() --- wcfsetup/install/files/lib/util/MessageUtil.class.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/wcfsetup/install/files/lib/util/MessageUtil.class.php b/wcfsetup/install/files/lib/util/MessageUtil.class.php index 1b3b31aea7..04601f006a 100644 --- a/wcfsetup/install/files/lib/util/MessageUtil.class.php +++ b/wcfsetup/install/files/lib/util/MessageUtil.class.php @@ -32,8 +32,9 @@ class MessageUtil { // unify new lines $text = StringUtil::unifyNewlines($text); - // remove emoji (MySQL 5.1 does not support them) - $text = preg_replace('~\xF0\x9F[\x80-\xBF][\x80-\xBF]~', '', $text); + // remove 4 byte utf-8 characters as MySQL < 5.5 does not support them + // see http://stackoverflow.com/a/16902461/782822 + $text = $text = preg_replace('/[\xF0-\xF7].../s', '', $text); // remove control characters $text = preg_replace('~[\x00-\x08\x0B-\x1F\x7F]~', '', $text); -- 2.20.1