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

Table engine detection fails with dot in database name #11798

Closed
bjdelange opened this Issue Dec 30, 2015 · 3 comments

Comments

Projects
None yet
4 participants
@bjdelange
Contributor

bjdelange commented Dec 30, 2015

When there's a dot in de name of the database, the explode in util.lib.php#27 provides an incorrect array, causing the table cache lookup to fail.
I noticed it because, when using InnoDB tables, it made the engine detection fail (returning "" instead of "InnoDB") which causes the Relation View to not display the foreign keys form.

@lem9

This comment has been minimized.

Show comment
Hide comment
@lem9

lem9 Dec 30, 2015

Contributor

Note: unfortunately, MySQL (from version 5.1.6) allows a dot in database name (if the name is escaped by backticks), see http://stackoverflow.com/questions/776123/does-mysql-allows-to-create-database-with-dot. So it seems we should fix this.

Contributor

lem9 commented Dec 30, 2015

Note: unfortunately, MySQL (from version 5.1.6) allows a dot in database name (if the name is escaped by backticks), see http://stackoverflow.com/questions/776123/does-mysql-allows-to-create-database-with-dot. So it seems we should fix this.

Achilles-96 added a commit to Achilles-96/phpmyadmin that referenced this issue Jan 3, 2016

Fixes #11798
Signed-off-by: Raghuram Vadapalli <raghuram.vadapalli@research.iiit.ac.in>

Achilles-96 added a commit to Achilles-96/phpmyadmin that referenced this issue Jan 3, 2016

Fixes #11798
Signed-off-by: Raghuram Vadapalli <raghuram.vadapalli@research.iiit.ac.in>

@lem9 lem9 referenced this issue Jan 3, 2016

Closed

Fixes #11798 #11807

@Achilles-96

This comment has been minimized.

Show comment
Hide comment
@Achilles-96

Achilles-96 Jan 4, 2016

Contributor

Alright, the main problem here is joining database name and table name with dot as in https://github.com/phpmyadmin/phpmyadmin/blob/master/libraries/Table.php#L329 but dot is accepted character in database name and table names by MySQL. Small modification may fix this particular bug but definitely there will be a problem in future.
In order to avoid future bugs due to this convention, we have to change all those instances where db name and table name are joined with dot and corresponding explode statements as well. The solution is that we should change separator to some character which is invalid for naming MySQL tables, but MySQL allows all characters in names.
Any suggestions are welcome.

Contributor

Achilles-96 commented Jan 4, 2016

Alright, the main problem here is joining database name and table name with dot as in https://github.com/phpmyadmin/phpmyadmin/blob/master/libraries/Table.php#L329 but dot is accepted character in database name and table names by MySQL. Small modification may fix this particular bug but definitely there will be a problem in future.
In order to avoid future bugs due to this convention, we have to change all those instances where db name and table name are joined with dot and corresponding explode statements as well. The solution is that we should change separator to some character which is invalid for naming MySQL tables, but MySQL allows all characters in names.
Any suggestions are welcome.

@nijel nijel added the bug label Jan 4, 2016

@nijel

This comment has been minimized.

Show comment
Hide comment
@nijel

nijel Jan 4, 2016

Member

Wouldn't be best to simply pass array in these cases? We already know all the individual items and the concatenation and parsing just makes the code slower...

Member

nijel commented Jan 4, 2016

Wouldn't be best to simply pass array in these cases? We already know all the individual items and the concatenation and parsing just makes the code slower...

nijel added a commit to nijel/phpmyadmin that referenced this issue Jan 4, 2016

Fix handling of databases with dot in a name
We do not need to concatenate and parse the items, the cache backend
accepts array directly.

Fixes #11798

Signed-off-by: Michal Čihař <michal@cihar.com>

@nijel nijel self-assigned this Jan 4, 2016

@nijel nijel added this to the 4.5.4 milestone Jan 4, 2016

@nijel nijel closed this in c197c3f Jan 5, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment