diff --git a/ChangeLog b/ChangeLog index c1b1cf1139..82416aaf09 100644 --- a/ChangeLog +++ b/ChangeLog @@ -76,6 +76,7 @@ phpMyAdmin - ChangeLog - issue #12511 Clarify documentation on ArbitraryServerRegexp - issue #12508 Remove duplicate code in SQL escaping - issue #12475 Cleanup code for getting table information +- issue #12579 phpMyAdmin's export of a Select statment without a FROM clause generates Wrong SQL 4.6.4 (2016-08-16) - issue [security] Weaknesses with cookie encryption, see PMASA-2016-29 diff --git a/tbl_export.php b/tbl_export.php index e8e7230cc0..fd6989d82e 100644 --- a/tbl_export.php +++ b/tbl_export.php @@ -67,13 +67,15 @@ if (! empty($sql_query)) { } // Rebuilding the SELECT and FROM clauses. - $replaces = array( - array( - 'FROM', 'FROM ' . SqlParser\Components\ExpressionArray::build( - $parser->statements[0]->from + if (count($parser->statements[0]->from) > 0) { + $replaces = array( + array( + 'FROM', 'FROM ' . SqlParser\Components\ExpressionArray::build( + $parser->statements[0]->from + ), ), - ), - ); + ); + } // Checking if the WHERE clause has to be replaced. if ((!empty($where_clause)) && (is_array($where_clause))) {