mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 05:58:34 +01:00
MDL-36113 - lib: Importing csv entries with empty lines in the middle doesn't throw errors.
This commit is contained in:
parent
6109f2112c
commit
415a6ffcc8
@ -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;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user