CMS MADE SIMPLE FORGE

CMS Made Simple Core

 

[#12495] MySQL 8.0.2+ breaks groups without table prefix

avatar
Created By: Maurice (mmakaay)
Date Submitted: Tue Nov 16 07:26:08 -0500 2021

Assigned To:
Version: 2.2.15
CMSMS Version: 2.2.15
Severity: Critical
Resolution: None
State: Open
Summary:
MySQL 8.0.2+ breaks groups without table prefix
Detailed Description:
I just upgraded my CMSMS installation, and ran into two issues that both might
be related to the same issue: MySQL 8.0.2 making GROUPS a reserved word. As a
result, a simple query like "SELECT * FROM groups" now yields a syntax error.

First thing is that I had to add the "group_desc" column to the "groups" table
manually. Possibly that was attempted by the upgrade code, but failed. So I did
"alter table `groups` add column `group_desc` varchar(255) DEFAULT NULL;"
I've seen an issue report from a while ago in which the code didn't add the new
field at all, but that was reported long fixed.

Additionally, I had to modify "lib/classes/class.group.inc.php" to modify all
queries that target the "groups" table, by escaping the identifier. So the
pattern that I applied was changing all occurences like:

SELECT group_id FROM '.CMS_DB_PREFIX.'groups WHERE

into

SELECT group_id FROM `'.CMS_DB_PREFIX.'groups` WHERE

This is not a problem for installations that have a CMS_DB_PREFIX defined, but
on my installation I'm using an empty prefix, resulting in the broken table name
handling.


History