From 3bb541c610e742b0cdb9ad7e64933fca0d3367a4 Mon Sep 17 00:00:00 2001 From: MarkBaker Date: Thu, 14 Apr 2016 23:20:07 +0100 Subject: [PATCH] GH-879 Bug in file PHPExcel/Reader/CSV.php Code logic identifying a defined separator when no separator is explicitly defined Case-insensitive check when separator is explicitly defined --- src/PhpSpreadsheet/Reader/CSV.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/PhpSpreadsheet/Reader/CSV.php b/src/PhpSpreadsheet/Reader/CSV.php index ef5a4972..aa044f4f 100644 --- a/src/PhpSpreadsheet/Reader/CSV.php +++ b/src/PhpSpreadsheet/Reader/CSV.php @@ -163,10 +163,11 @@ class CSV extends BaseReader implements IReader return; } - if ((strlen(trim($line)) == 5) && (strpos($line, 'sep=') !== 0)) { - return $this->skipBOM(); + if ((strlen(trim($line, "\r\n")) == 5) && (stripos($line, 'sep=') === 0)) { + $this->delimiter = substr($line, 4, 1); + return; } - $this->delimiter = substr($line, 4, 1); + return $this->skipBOM(); } /**