From d6aa978f462805da2e282b99259e581283258665 Mon Sep 17 00:00:00 2001 From: Zack Katz Date: Fri, 19 Jun 2015 17:33:05 -0600 Subject: [PATCH] Fix issue when "0" is the only value in the first line The goal of the code was to skip empty padding row between the header and the body. The previous code skips valid first row values: ``` Numbers 0 1 2 3 ``` Only 1, 2, 3 would be processed. This fixes that. --- src/Goodby/CSV/Import/Standard/Lexer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Goodby/CSV/Import/Standard/Lexer.php b/src/Goodby/CSV/Import/Standard/Lexer.php index 7631791..4cd6e0f 100644 --- a/src/Goodby/CSV/Import/Standard/Lexer.php +++ b/src/Goodby/CSV/Import/Standard/Lexer.php @@ -57,7 +57,7 @@ public function parse($filename, InterpreterInterface $interpreter) setlocale(LC_ALL, 'en_US.UTF-8'); foreach ( $csv as $lineNumber => $line ) { - if ($ignoreHeader && $lineNumber == 0 || (count($line) === 1 && empty($line[0]))) { + if ($ignoreHeader && $lineNumber == 0 || (count($line) === 1 && trim($line[0]) === '')) { continue; } $interpreter->interpret($line);