In parse method of CSVParser there is

 if (!$header) {
        return;
      }

So it can return null.

In import method of FeedsSource.inc there is

$parser_result = $this->importer->parser->parse($this, $this->fetcher_result);
module_invoke_all('feeds_after_parse', $this, $parser_result);

if $parser_result is null and you have your custom after_parse hook(what actually happened to me) null will be passed as the second argument and you will get fatal error like:
Recoverable fatal error: Argument 2 passed to custom_module_feeds_after_parse() must be an instance of FeedsParserResult

CommentFileSizeAuthor
#2 feeds.checkread.1982286-2.patch1.2 KBadamps

Comments

adamps’s picture

Title: Parse method of CSVParser can return null » Recoverable fatal error
Issue summary: View changes

Specifically this can occur if the CSV file exists but does not have read permission. Potentially there are other scenarios.

It would help a lot to have better error reporting.

adamps’s picture

Status: Active » Needs review
StatusFileSize
new1.2 KB

Here is a patch that checks the file can be read rather than just exists.

Status: Needs review » Needs work

The last submitted patch, 2: feeds.checkread.1982286-2.patch, failed testing.

  • twistor committed 7a90169 on 7.x-2.x authored by AdamPS
    Issue #1982286 by AdamPS: Recoverable fatal error
    
twistor’s picture

Status: Needs work » Fixed

It looks like you're using an old version of Feeds. FeedsCSVParser::parse() can never return null.

The patch in #2 is a good idea anyway.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

adamps’s picture

Sorry I missed the notification email so have only just seen your response - thanks!