From d364ce1d9da395266bb13659fa4249f29f9bc15d Mon Sep 17 00:00:00 2001 From: Alex Barth <alex_b@53995.no-reply.drupal.org> Date: Tue, 27 Jul 2010 17:55:44 +0000 Subject: [PATCH] #858684: Fix notices when file not found. --- CHANGELOG.txt | 5 +++++ plugins/FeedsCSVParser.inc | 3 +++ plugins/FeedsFileFetcher.inc | 3 +++ 3 files changed, 11 insertions(+) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index af783e72..453bc249 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,5 +1,10 @@ // $Id$ +Feeds 6.x 1.0 XXXXXXXXXXXXXXXXXX +-------------------------------- + +- #858684 alex_b: Fix notices when file not found. + Feeds 6.x 1.0 Beta 4, 2010-07-25 -------------------------------- diff --git a/plugins/FeedsCSVParser.inc b/plugins/FeedsCSVParser.inc index 96e74718..a551bebf 100644 --- a/plugins/FeedsCSVParser.inc +++ b/plugins/FeedsCSVParser.inc @@ -22,6 +22,9 @@ class FeedsCSVParser extends FeedsParser { // Get first line and use it for column names, convert them to lower case. $parser->setLineLimit(1); $rows = $parser->parse($iterator); + if (!count($rows)) { + return; + } $header = array_shift($rows); foreach ($header as $i => $title) { $header[$i] = trim(drupal_strtolower($title)); diff --git a/plugins/FeedsFileFetcher.inc b/plugins/FeedsFileFetcher.inc index 271c0d33..0ba80a98 100644 --- a/plugins/FeedsFileFetcher.inc +++ b/plugins/FeedsFileFetcher.inc @@ -32,6 +32,9 @@ class FeedsFileBatch extends FeedsImportBatch { * Implementation of FeedsImportBatch::getFilePath(). */ public function getFilePath() { + if (!file_exists($this->file_path)) { + throw new Exception(t('File @filepath is not accessible.', array('@filepath' => $this->file_path))); + } return $this->file_path; } } -- GitLab