-
Bug
-
Resolution: Invalid
-
Major
-
None
-
3.3.4
-
None
-
PHP 8 (php:8.0.9-apache docker image), MySQL 8.0.26
After upgrading from MySQL 7.4 to 8.0, I encountered the following error when trying to access any page:
SQL ERROR [ mysqli ]
|
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'groups g ON (m.group_id = g.group_id) WHERE m.display_on_index = 1' at line 1 [1064] |
SQL
|
SELECT m.*, u.user_colour, g.group_colour, g.group_type FROM (moderator_cache m) LEFT JOIN users u ON (m.user_id = u.user_id) LEFT JOIN groups g ON (m.group_id = g.group_id) WHERE m.display_on_index = 1 |
BACKTRACE
|
FILE: (not given by php)
|
LINE: (not given by php)
|
CALL: msg_handler()
|
FILE: [ROOT]/phpbb/db/driver/driver.php
|
LINE: 1023 |
CALL: trigger_error()
|
FILE: [ROOT]/phpbb/db/driver/mysqli.php
|
LINE: 195 |
CALL: phpbb\db\driver\driver->sql_error()
|
FILE: [ROOT]/phpbb/db/driver/factory.php
|
LINE: 345 |
CALL: phpbb\db\driver\mysqli->sql_query()
|
FILE: [ROOT]/includes/functions_display.php
|
LINE: 939 |
CALL: phpbb\db\driver\factory->sql_query()
|
FILE: [ROOT]/includes/functions_display.php
|
LINE: 386 |
CALL: get_moderators()
|
FILE: [ROOT]/index.php
|
LINE: 87 |
CALL: display_forums()
|
|
As other people have identified, this is because "groups" is a reserved keyword in MySQL 8: https://dev.mysql.com/doc/refman/8.0/en/keywords.html#keywords-8-0-detailed-G.
There appear to be at least a couple different solutions:
- Require a non-empty "$table_prefix" so that there is no table named "groups".
- Escape the table names in the SQL queries.
Please let me know if there's any further information I can provide. Thank you for your time!
In case it's needed, here is my config.php:
<?php
|
// phpBB 3.0.x auto-generated configuration file
|
// Do not change anything in this file!
|
$dbms = 'phpbb\\db\driver\\mysqli'; |
$dbhost = '<redacted>'; |
$dbport = ''; |
$dbname = '<redacted>'; |
$dbuser = '<redacted>'; |
$dbpasswd = '<redacted>'; |
$table_prefix = ''; |
$acm_type = 'file'; |
$load_extensions = ''; |
@define('PHPBB_INSTALLED', true); |
@define('DEBUG', false); |
@define('DEBUG_EXTRA', false); |
?>
|