From a0ddedc005722daf15586fdc053c0d3ea2e53a63 Mon Sep 17 00:00:00 2001 From: Ryan Cramer Date: Tue, 31 Dec 2019 14:05:15 -0500 Subject: [PATCH] Update SessionHandlerDB to support utf8mb4 charset for its table when $config->dbCharset specifies it. --- wire/modules/Session/SessionHandlerDB/SessionHandlerDB.module | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/wire/modules/Session/SessionHandlerDB/SessionHandlerDB.module b/wire/modules/Session/SessionHandlerDB/SessionHandlerDB.module index 555df266..e803a2da 100644 --- a/wire/modules/Session/SessionHandlerDB/SessionHandlerDB.module +++ b/wire/modules/Session/SessionHandlerDB/SessionHandlerDB.module @@ -182,6 +182,7 @@ class SessionHandlerDB extends WireSessionHandler implements Module, Configurabl public function ___install() { $table = self::dbTableName; + $charset = $this->wire('config')->dbCharset; $sql = "CREATE TABLE `$table` (" . "id CHAR(32) NOT NULL, " . @@ -195,7 +196,7 @@ class SessionHandlerDB extends WireSessionHandler implements Module, Configurabl "INDEX (pages_id), " . "INDEX (user_id), " . "INDEX (ts) " . - ") ENGINE=InnoDB DEFAULT CHARSET=utf8"; + ") ENGINE=InnoDB DEFAULT CHARSET=$charset"; $this->database->query($sql); }