From: Roland Häder Date: Thu, 26 Aug 2021 02:16:20 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=93a44a93d7d790d1e6dbe53f40f6c1582f2a730b;p=core.git Continued: - skip empty lines Signed-off-by: Roland Häder --- 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?