From 59cd9bf3a1b6cf292e4d3700301d7d0328977e8d Mon Sep 17 00:00:00 2001 From: Deven Bansod Date: Wed, 28 Sep 2016 19:23:12 +0530 Subject: [PATCH] Replace FROM clause aliases only if FROM clause is present Fix #12579 Signed-off-by: Deven Bansod --- tbl_export.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/tbl_export.php b/tbl_export.php index 8c703f0197..542dfd9c84 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))) {