MDL-36113 - lib: Importing csv entries with empty lines in the middle doesn't throw errors.

This commit is contained in:
Adrian Greeve
2012-11-07 15:34:29 +08:00
parent 6109f2112c
commit 415a6ffcc8
+9 -1
View File
@@ -105,7 +105,15 @@ class csv_import_reader {
// str_getcsv doesn't iterate through the csv data properly. It has
// problems with line returns.
while ($fgetdata = fgetcsv($fp, 0, $csv_delimiter, $enclosure)) {
$columns[] = $fgetdata;
// Check to see if we have an empty line.
if (count($fgetdata) == 1) {
if ($fgetdata[0] !== null) {
// The element has data. Add it to the array.
$columns[] = $fgetdata;
}
} else {
$columns[] = $fgetdata;
}
}
$col_count = 0;