From 93a44a93d7d790d1e6dbe53f40f6c1582f2a730b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Thu, 26 Aug 2021 04:16:20 +0200 Subject: [PATCH] Continued: - skip empty lines MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- .../text/input/csv/class_CsvInputFile.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/framework/main/classes/file_directories/text/input/csv/class_CsvInputFile.php b/framework/main/classes/file_directories/text/input/csv/class_CsvInputFile.php index b9c5f162..81079f2e 100644 --- a/framework/main/classes/file_directories/text/input/csv/class_CsvInputFile.php +++ b/framework/main/classes/file_directories/text/input/csv/class_CsvInputFile.php @@ -86,8 +86,15 @@ class CsvInputFile extends BaseInputTextFile implements CsvInputStreamer { // Read raw line and trim anything unwanted away $data = trim($this->getPointerInstance()->readLine()); - // Parse data + // Is the line empty? /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d:] data(%d)=%s', __METHOD__, __LINE__, strlen($data), $data)); + if (empty($data)) { + // Yes, then skip below code + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d:] Read data is an empty line - EXIT!', __METHOD__, __LINE__)); + return; + } + + // Parse data $lineArray = $this->parseDataToIndexedArray($data, $columnSeparator); // Is the expected count found? -- 2.39.5