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

Column sorting does not work when names contain dots #19155

Open
MoonE opened this issue May 11, 2024 · 0 comments
Open

Column sorting does not work when names contain dots #19155

MoonE opened this issue May 11, 2024 · 0 comments

Comments

@MoonE
Copy link
Contributor

MoonE commented May 11, 2024

Describe the bug

A clear and concise description of what the bug is.

To Reproduce

Steps to reproduce the behavior:

  1. Create a table like this:
CREATE TABLE `as.df` (
  `i.d` int(11) NOT NULL AUTO_INCREMENT,
  `a.b.c` int(11) NOT NULL,
  PRIMARY KEY (`i.d`)
);

INSERT INTO `as.df` (`i.d`, `a.b.c`) VALUES
(1, 1),
(2, 2);
  1. Browse table
  2. Click column header to change sorting
  3. Nothing happens

Expected behavior

The column should be sorted.

Server configuration

  • Operating system: Linux
  • Web server: Apache 2.4
  • Database version: MariaDB 10.11.6
  • PHP version: 8.2
  • phpMyAdmin version: 5.2.2 da10e0b

Client configuration

  • Browser: Firefox 125.0.3
  • Operating system: Linux

Additional context

The code uses str_contains($clause, '.') to check whether the name has table and column parts and explode('.', $clause) to split table from column.

foreach ($sortExpressionNoDirection as $index => $clause) {
if (str_contains($clause, '.')) {
$fragments = explode('.', $clause);

The name should have never been concatenated in the first place, better use an array.

This problem affects a few other places where explode is used, too.

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

1 participant