diff --git a/ChangeLog b/ChangeLog index 3d7365cbc6..774339f58e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,7 +4,7 @@ phpMyAdmin - ChangeLog 4.1.4.0 (not yet released) - bug #3840 (additional fix) When exporting to gzip format, the data is compressed 2 times - bug #4209 Missing compression in one case - +- bug #4208 Can't browse tables after sorting on columns with fieldnames that have a '-' 4.1.3.0 (2013-12-31) - bug #3938 PDFDefaultPageSize doc and easy configurability - bug #4198 Hovering over pie chart gives fatal JS error diff --git a/libraries/sql.lib.php b/libraries/sql.lib.php index 788a9d9bca..35ebf2d94e 100644 --- a/libraries/sql.lib.php +++ b/libraries/sql.lib.php @@ -230,10 +230,11 @@ function PMA_handleSortOrder($db, $table, &$analyzed_sql_results, &$full_sql_que if (empty($analyzed_sql_results['analyzed_sql'][0]['order_by_clause'])) { $sorted_col = $pmatable->getUiProp(PMA_Table::PROP_SORTED_COLUMN); if ($sorted_col) { - //remove the backquoting and tablename from retrieved preference - //to get just column name - $sorted_col = str_replace('`', '', $sorted_col); - $sorted_col = str_replace($table . '.', '', $sorted_col); + //remove the tablename from retrieved preference + //to get just the column name and the sort order + $sorted_col = str_replace( + PMA_Util::backquote($table) . '.', '', $sorted_col + ); // retrieve the remembered sorting order for current table $sql_order_to_append = ' ORDER BY ' . $sorted_col . ' '; $full_sql_query @@ -2278,7 +2279,7 @@ function PMA_executeQueryAndSendQueryResponse($analyzed_sql_results, // Handle remembered sorting order, only for single table query // Handling is not required when it's a union query // (the parser never sets the 'union' key to 0) - if (PMA_isRememberSortingOrder($analyzed_sql_results) + if (PMA_isRememberSortingOrder($analyzed_sql_results) && ! isset($analyzed_sql_results['analyzed_sql'][0]['queryflags']['union']) ) { PMA_handleSortOrder($db, $table, $analyzed_sql_results, $full_sql_query);