Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MySQL server has gone away - Invalid query #1548

Open
gloobus opened this issue Feb 3, 2022 · 1 comment
Open

MySQL server has gone away - Invalid query #1548

gloobus opened this issue Feb 3, 2022 · 1 comment

Comments

@gloobus
Copy link

gloobus commented Feb 3, 2022

CodeIgniter v3 + CodeIgniter-Ion-Auth
PHP 7.4
MariaDB 5.5.68

CodeIgniter log:

ERROR - 2022-02-02 08:55:59 --> Query error: MySQL server has gone away - Invalid query: SELECT t_users.*, t_users.id as id, t_users.id as user_id
FROM t_users
WHERE t_users.id = '546'
ORDER BY t_users.id DESC
LIMIT 1

The problem was solved in the following way, Ion_auth_model.php:

$this->db->select([
$this->tables['users'].'.*',
// $this->tables['users'].'.id as id',
$this->tables['users'].'.id as user_id'
]);

Why is ID as ID displayed in this SELECT?
ID from the user table is still returned through <*>.
After I removed the $this->tables['users'].'.id as id' output, the errors stopped

@benedmunds
Copy link
Owner

"MySQL server has gone away" is usually a connection error. Truthfully I don't remember the reason for this, I think it was to account for custom selects.

This code has been here for over 10 years though so my best guess is that it's a coincidence that this fixed it and there was a connection error. It is possible that a newer MySQL version is failing on this though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants