The branch, master has been updated via 7cbaf739e40a2642d0a3176a8cf961bfdea8ec75 (commit) via 489d6bfce8447ca1a8a335fc7580c6b8b8963bf1 (commit) from 612598fe7fbc6c6cf6305a798e9b48b435ea7a91 (commit)
- Log ----------------------------------------------------------------- commit 7cbaf739e40a2642d0a3176a8cf961bfdea8ec75 Merge: 489d6bfce8447ca1a8a335fc7580c6b8b8963bf1 612598fe7fbc6c6cf6305a798e9b48b435ea7a91 Author: Madhura Jayaratne madhura.cj@gmail.com Date: Sat Mar 5 09:55:10 2011 +0530
Merge branch 'master' of ssh://phpmyadmin.git.sourceforge.net/gitroot/phpmyadmin/phpmyadmin
commit 489d6bfce8447ca1a8a335fc7580c6b8b8963bf1 Author: Madhura Jayaratne madhura.cj@gmail.com Date: Sat Mar 5 09:53:51 2011 +0530
Bug #3196093 CSV import - Abort immediately and show error message on invalid parameters.
-----------------------------------------------------------------------
Summary of changes: libraries/import/csv.php | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/libraries/import/csv.php b/libraries/import/csv.php index db8d09c..e41ea35 100644 --- a/libraries/import/csv.php +++ b/libraries/import/csv.php @@ -56,10 +56,12 @@ $csv_enclosed = strtr($csv_enclosed, $replacements); $csv_escaped = strtr($csv_escaped, $replacements); $csv_new_line = strtr($csv_new_line, $replacements);
+$param_error = FALSE; if (strlen($csv_terminated) != 1) { $message = PMA_Message::error(__('Invalid parameter for CSV import: %s')); $message->addParam(__('Columns terminated by'), false); $error = TRUE; + $param_error = TRUE; // The default dialog of MS Excel when generating a CSV produces a // semi-colon-separated file with no chance of specifying the // enclosing character. Thus, users who want to import this file @@ -72,14 +74,22 @@ if (strlen($csv_terminated) != 1) { $message = PMA_Message::error(__('Invalid parameter for CSV import: %s')); $message->addParam(__('Columns enclosed by'), false); $error = TRUE; + $param_error = TRUE; } elseif (strlen($csv_escaped) != 1) { $message = PMA_Message::error(__('Invalid parameter for CSV import: %s')); $message->addParam(__('Columns escaped by'), false); $error = TRUE; + $param_error = TRUE; } elseif (strlen($csv_new_line) != 1 && $csv_new_line != 'auto') { $message = PMA_Message::error(__('Invalid parameter for CSV import: %s')); $message->addParam(__('Lines terminated by'), false); $error = TRUE; + $param_error = TRUE; +} + +// If there is an error in the parameters entered, indicate that immediately. +if ($param_error) { + PMA_mysqlDie($message->getMessage(), '', '', $err_url); }
$buffer = '';
hooks/post-receive