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

Adjust Privileges on copy database fails with MariaDB #15311

Closed
WanWizard opened this issue Jun 7, 2019 · 1 comment
Closed

Adjust Privileges on copy database fails with MariaDB #15311

WanWizard opened this issue Jun 7, 2019 · 1 comment
Assignees
Labels
Bug A problem or regression with an existing feature
Projects
Milestone

Comments

@WanWizard
Copy link
Contributor

WanWizard commented Jun 7, 2019

Describe the bug

When you copy a database on MariaDB, and check the "Adjust privileges" checkbox, you get the error " column count doesn't match value count" on the mysql.db insert in adjustPrivilegesCopyDb().

To Reproduce

Go to Operations and select Copy database when using MariaDB.

Expected behavior

No error messages, and privileges copied.

Server configuration

  • Operating system: Fedora 30
  • Web server: Apache 2.4.30
  • Database version: MariaDB 10.3.12
  • PHP version: 7.3.5
  • phpMyAdmin version: 4.9.0.1

Client configuration

  • Browser: Chromium
  • Operating system: Fedora 30

Additional context

The reason for this error is that adjustPrivilegesCopyDb() has the column count hardcoded, and it fails because in MariaDB, the mysql.db table has 23 columns, not 22.

It can be address by changing the code to

            foreach ($old_privs_db as $old_priv) {
                $newDb_db_privs_query = 'INSERT INTO ' . Util::backquote('db')
                    . ' VALUES("' . $old_priv[0] . '", "' . $newname . '"';
                    for ($i = 2; $i < count($old_priv); $i++) {
                        $newDb_db_privs_query .= ', "'.$old_priv[$i].'"';
                    }
                    $newDb_db_privs_query .= ')';
                $GLOBALS['dbi']->query($newDb_db_privs_query);
            }

I have not checked the code for other privilege tables, as I don't use those.

@williamdes williamdes added the Bug A problem or regression with an existing feature label Jun 7, 2019
@williamdes williamdes added this to Needs triage in issues via automation Jun 7, 2019
@williamdes williamdes moved this from Needs triage to Medium priority in issues Jun 7, 2019
@williamdes williamdes self-assigned this Oct 21, 2019
@williamdes williamdes added this to the 4.9.2 milestone Oct 21, 2019
williamdes added a commit to williamdes/phpmyadmintest that referenced this issue Oct 21, 2019
Signed-off-by: William Desportes <williamdes@wdes.fr>
@williamdes
Copy link
Member

williamdes commented Oct 21, 2019

@WanWizard I imported your fix as 157582c

Thanks for the report and the fix, will be included in next release of phpMyAdmin

@williamdes williamdes moved this from Medium priority to Closed in issues Oct 21, 2019
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A problem or regression with an existing feature
Projects
issues
  
Closed
Development

No branches or pull requests

2 participants