Skip to content

Commit

Permalink
Fix #12399: Adding index to table shows wrong top navigation
Browse files Browse the repository at this point in the history
If the SQL query analyzing sets the $table value to '',
don't update the original value

Signed-off-by: Deven Bansod <devenbansod.bits@gmail.com>
  • Loading branch information
devenbansod committed Aug 1, 2016
1 parent 9ee479b commit 2c5541a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
12 changes: 10 additions & 2 deletions import.php
Expand Up @@ -742,10 +742,14 @@
list(
$analyzed_sql_results,
$db,
$table
$table_from_sql
) = PMA_parseAnalyze($sql_query, $db);
// @todo: possibly refactor
extract($analyzed_sql_results);

if ($table != $table_from_sql && !empty($table_from_sql)) {
$table = $table_from_sql;
}
}

// There was an error?
Expand Down Expand Up @@ -774,11 +778,15 @@
list(
$analyzed_sql_results,
$db,
$table
$table_from_sql
) = PMA_parseAnalyze($sql_query, $db);
// @todo: possibly refactor
extract($analyzed_sql_results);

if ($table != $table_from_sql && !empty($table_from_sql)) {
$table = $table_from_sql;
}

$html_output .= PMA_executeQueryAndGetQueryResponse(
$analyzed_sql_results, // analyzed_sql_results
false, // is_gotofile
Expand Down
6 changes: 5 additions & 1 deletion libraries/sql.lib.php
Expand Up @@ -2035,10 +2035,14 @@ function PMA_executeQueryAndSendQueryResponse($analyzed_sql_results,
list(
$analyzed_sql_results,
$db,
$table
$table_from_sql
) = PMA_parseAnalyze($sql_query, $db);
// @todo: possibly refactor
extract($analyzed_sql_results);

if ($table != $table_from_sql && !empty($table_from_sql)) {
$table = $table_from_sql;
}
}

$html_output = PMA_executeQueryAndGetQueryResponse(
Expand Down
6 changes: 5 additions & 1 deletion sql.php
Expand Up @@ -141,11 +141,15 @@
list(
$analyzed_sql_results,
$db,
$table
$table_from_sql
) = PMA_parseAnalyze($sql_query, $db);
// @todo: possibly refactor
extract($analyzed_sql_results);

if ($table != $table_from_sql && !empty($table_from_sql)) {
$table = $table_from_sql;
}


/**
* Check rights in case of DROP DATABASE
Expand Down

0 comments on commit 2c5541a

Please sign in to comment.