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
Exporting results of SQL query causes "bad parameters" error when a database is not selected first #14773
Comments
|
So what should we do to fix this issue? |
|
Successfully reproduced on demo servers (root, no password) @Gaurav-Punjabi The data should export as expected ;) |
@Gaurav-Punjabi We should debug if the database is selected by the export query, as per my experience, I tried selecting database many times but on the error, I kept finding out that database gets unselect. |
|
This piece of code makes sure that a table is always selected when we export, phpmyadmin/libraries/classes/Display/Results.php Lines 5229 to 5235 in 0a0bc2c
But since we don't have any database selected it fails. Should we explicitly set the database and table to a string 'none' so that export doesn't fail ? |
|
Couldn't reproduce this on latest version, should this be closed? |
|
@williamdes I agree with @nmilo |
|
I could reproduce this on the current 4.8 version: Reproduction steps:
|
if database is not selected then we have to take database name from sql_query . right? |
|
@williamdes if database is not selected then we have to take database name from sql_query . right? |
|
@shifatbuet Would make sense, but what if the query uses a join ? |
|
@williamdes I was thinking about this :
|
|
@shifatbuet You should not do that, we have https://github.com/phpmyadmin/sql-parser to do the work :) |
|
@williamdes okay. may be i have to do it in URL . like CommonParams.set('db', data.params.db);. I am really confused , how to do it from php code and also refresh so that url shows db= something. Can you help me a little bit? |
|
@shifatbuet I think we need a different approach: disable the db verification beacause the query of this issue is |
Signed-off-by: William Desportes <williamdes@wdes.fr>
Describe the bug
Exporting results of SQL query causes "bad parameters" error when a database is not selected first
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Expect to generate a file containing query results
Screenshots
Server configuration
Client configuration
Additional context
The "bad parameters" message is generated on line 292 in export.php:
phpmyadmin/export.php
Lines 274 to 293 in 2fc8bb1
The problem appears to be the fact that since we ran the query without selecting a database yet, the $db parameter is not present in the POST request, triggering the fatal error.
The text was updated successfully, but these errors were encountered: