From f417479e3da4b9371d3de2d4841a73989a81a367 Mon Sep 17 00:00:00 2001 From: Adrian Greeve Date: Tue, 9 Oct 2012 11:58:46 +0800 Subject: [PATCH] MDL-35850 - Lib - csv files are now trimmed for white space and new lines at the end of the file. --- lib/csvlib.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/csvlib.class.php b/lib/csvlib.class.php index bb09dd0d802..c178a25315e 100644 --- a/lib/csvlib.class.php +++ b/lib/csvlib.class.php @@ -90,6 +90,8 @@ class csv_import_reader { $content = textlib::trim_utf8_bom($content); // Fix mac/dos newlines $content = preg_replace('!\r\n?!', "\n", $content); + // Remove any spaces or new lines at the end of the file. + $content = trim($content); $csv_delimiter = csv_import_reader::get_delimiter($delimiter_name); // $csv_encode = csv_import_reader::get_encoded_delimiter($delimiter_name);