From: Roland Häder Date: Thu, 16 Sep 2021 02:13:14 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=ffeed85befa4119c5c3b2ec378d46e8af8838840;p=hub.git Continued: - readCsvFileLine() returns a non-array (currently NULL) when the end-of-file has been reached, this needs to be respected here. Signed-off-by: Roland Häder --- diff --git a/application/hub/classes/source/urls/class_CrawlerUploadedListUrlSource.php b/application/hub/classes/source/urls/class_CrawlerUploadedListUrlSource.php index d9cfeb9be..7a5bf1a88 100644 --- a/application/hub/classes/source/urls/class_CrawlerUploadedListUrlSource.php +++ b/application/hub/classes/source/urls/class_CrawlerUploadedListUrlSource.php @@ -305,8 +305,16 @@ class CrawlerUploadedListUrlSource extends BaseUrlSource implements UrlSource, R // Read full "CSV line" $csvData = $csvFileInstance->readCsvFileLine($this->columnSeparator, self::CRAWL_ENTRY_SIZE); + // Is $csvData set? + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('CRAWLER-UPLOADED-LIST-URL-SOURCE: csvData[]=%s', gettype($csvData))); + if (!is_array($csvData)) { + // Is not array, then reading the file has reached EOF + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-UPLOADED-LIST-URL-SOURCE: EXIT!'); + return; + } + // Is the array empty? - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('CRAWLER-UPLOADED-LIST-URL-SOURCE: csvData[%s]=%s', gettype($csvData), print_r($csvData, TRUE))); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('CRAWLER-UPLOADED-LIST-URL-SOURCE: csvData(%d)=%s', count($csvData), print_r($csvData, TRUE))); if (count($csvData) == 0) { // Try to close it by actually unsetting (destructing) it /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('CRAWLER-UPLOADED-LIST-URL-SOURCE: File "%s" has been fully read.', $csvFileInstance->getFilename()));