Fix importing files without trailing new line (bug #1473944).

This commit is contained in:
Michal Čihař
2006-04-21 07:55:12 +00:00
parent 1ac36fe3b7
commit 094805dcbe
2 changed files with 10 additions and 3 deletions

View File

@@ -5,6 +5,10 @@ phpMyAdmin - Changelog
$Id$ $Id$
$Source$ $Source$
2006-04-21 Michal Čihař <michal@cihar.com>
* libraries/import/csv.php: Fix importing files without trailing new line
(bug #1473944).
2006-04-20 Michal Čihař <michal@cihar.com> 2006-04-20 Michal Čihař <michal@cihar.com>
* index.php: Check target against goto_whitelist. * index.php: Check target against goto_whitelist.
* libraries/url_generating.lib.php, libraries/session.inc.php, * libraries/url_generating.lib.php, libraries/session.inc.php,

View File

@@ -191,13 +191,16 @@ if ($plugin_param == 'table') {
} }
// Need to strip trailing enclosing char? // Need to strip trailing enclosing char?
if ($need_end && $ch == $csv_enclosed) { if ($need_end && $ch == $csv_enclosed) {
if ($i == $len - 1) { if ($finished && $i == $len - 1) {
$ch = NULL;
} elseif ($i == $len - 1) {
$i = $fallbacki; $i = $fallbacki;
$ch = $buffer[$i]; $ch = $buffer[$i];
break; break;
} else {
$i++;
$ch = $buffer[$i];
} }
$i++;
$ch = $buffer[$i];
} }
// Are we at the end? // Are we at the end?
if ($ch == $csv_new_line || ($csv_new_line == 'auto' && ($ch == "\r" || $ch == "\n")) || ($finished && $i == $len - 1)) { if ($ch == $csv_new_line || ($csv_new_line == 'auto' && ($ch == "\r" || $ch == "\n")) || ($finished && $i == $len - 1)) {