From a1d95a21ae58e234ddc70e009f603850d4f64032 Mon Sep 17 00:00:00 2001 From: Ben Davies Date: Mon, 4 Feb 2019 14:00:46 +0000 Subject: [PATCH] move valid check to beginning of loop --- src/CsvReader.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/CsvReader.php b/src/CsvReader.php index c50871f..b209157 100644 --- a/src/CsvReader.php +++ b/src/CsvReader.php @@ -112,7 +112,7 @@ public function current() } // Since the CSV has column headers use them to construct an associative array for the columns in this line - do { + while($this->valid()) { $line = $this->file->current(); // In non-strict mode pad/slice the line to match the column headers @@ -139,7 +139,7 @@ public function current() $this->errors[$this->key()] = $line; $this->next(); } - } while($this->valid()); + } return null; }