]> git.mxchange.org Git - core.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Thu, 26 Aug 2021 02:16:20 +0000 (04:16 +0200)
committerRoland Häder <roland@mxchange.org>
Thu, 26 Aug 2021 02:16:20 +0000 (04:16 +0200)
- skip empty lines

Signed-off-by: Roland Häder <roland@mxchange.org>
framework/main/classes/file_directories/text/input/csv/class_CsvInputFile.php

index b9c5f16284f5db06b2df52c18c4eaf4f519328a3..81079f2ecae7e1d5b6c557bfa06c535e1bbc4a98 100644 (file)
@@ -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?