I have a table like this:
CREATE TABLE `sessions` (
`id` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '',
`access` int unsigned DEFAULT NULL,
`data` mediumtext,
PRIMARY KEY (`id`),
KEY `access_idx` (`access`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
In MySQL 5 that worked perfectly well when I stored a small binary object in the session.
In MySQL 8 the stored session data is cut off right where that binary object starts. So when I load the session after writing the session with the binary data, session_start()
fails to deserialize the session data and immediately calls session_destroy()
We changed the data
column to mediumblob
and that fixes the error.
So two questions: What changed between MySQL 5 and 8, and is there a problem with using a BLOB column for session storage?