Im getting this error after running cron
Notice: Undefined index: FeedsXPathParserXML in FeedsSource->getConfigFor() (line 577 of [redacted]/sites/all/modules/feeds/includes/FeedsSource.inc).
Does anyone know what it means, and why I'm getting it? Thanks.

Comments

oobie11’s picture

Issue summary: View changes

Edit

oobie11’s picture

Title: Im getting an error after running cron » What is this error all about?

Anyone

oobie11’s picture

Title: What is this error all about? » Im getting an error after running cron
philipz’s picture

Title: Notice: Undefined index: FeedsXPathParserXML on import » Im getting an error after running cron

I'm getting the same error after running import manually from /import page.
I've found so far that line 36 in FeedsXPathParserBase.inc there's a call for config witch is the reason for notice message.

$source_config = $source->getConfigFor($this);

Next there's a check if the $source_config is empty.
I removed line 36 and it's working fine but I don't know yet if it might be necessary?

philipz’s picture

Title: What is this error all about? » Notice: Undefined index: FeedsXPathParserXML on import
twistor’s picture

Title: Im getting an error after running cron » Notice: Undefined index: FeedsXPathParserXML on import
Assigned: Unassigned » twistor

Does this happen after you have used the importer with a different parser first?

philipz’s picture

I might had used other imports with diffrent parser (CSV) but not this one. This one was XPath from the start.

Yorgg’s picture

Version: 7.x-1.x-dev » 7.x-1.0-beta3

I am also getting this on updated beta3 two times in a row for each import.
Anyone figure out this yet?

emilcarpenter’s picture

Yes - sort of, for me it happens after using a different importer, but with the same parser.

I thought that maybe foreign characters such as åäö ñ ã in the HTTPFetcher URL affect this, I have to check this one more time. I convert them using:

$url1_encoded = rawurlencode(utf8_decode($url_alt1));

I do the importing programmatically.

Something else than using different importers affects this too. This did not happen before, but after some Rules redirects coding and other stuff, this notice message started appearing. Maybe after I accidentally redirected with code 200 instead of 301 with drupal_goto and got a blank white page in the browser. I have not updated any modules before vs after the notice message. I'll see if I get to some more conclusions, will post here if so.

My imports are working fine despite this notice message.

And... thank you Twistor for the Feeds, Feeds Tamper and Xpath Parser modules - so great!

PS Using Drupal 7.9, Feeds 7.x-2.0-alpha4, Feeds XpathParser 7.x-1.x-dev, Feeds Tamper 7.x-1.x-dev
Edit: XPathParser dev is from: ; Information added by drupal.org packaging script on 2011-10-13

steinmb’s picture

Also see this running manual import. Clean install of Drupal and feeds + xpath.
Notice: Undefined index: FeedsXPathParserXML in FeedsSource->getConfigFor() (line 577 drupal-7.10/sites/all/modules/feeds/includes/FeedsSource.inc)

XML I tried to import was http://www.yr.no/place/Norway/Hordaland/Bergen/Bergen/forecast.xml

emilcarpenter’s picture

Ok, guys!

Workaround:

I used this code for importing. This gave the error when i switched to import with another importer (but with the same parser):

<?php
$myFeed = feeds_source('xml_first_importer');
$config = array('FeedsHTTPFetcher'=>array('source'=>$url_first));
$myFeed->addConfig($config);

while (FEEDS_BATCH_COMPLETE != $myFeed->import());

// ... some other code...

$myFeed = feeds_source('xml_second_importer');
$config = array('FeedsHTTPFetcher'=>array('source'=>$url_second));
$myFeed->addConfig($config);

while (FEEDS_BATCH_COMPLETE != $myFeed->import());

?>

Since the configuration seemed not to be able to be read, I figured it was not set properly, so I set it twice:

$myFeed = feeds_source('xml_first_importer');
$config = array('FeedsHTTPFetcher'=>array('source'=>$url_first));
$myFeed->addConfig($config);

$myFeed = NULL; // Added this

$myFeed = feeds_source('xml_first_importer');  // Added this
$config = array('FeedsHTTPFetcher'=>array('source'=>$url_first));  // Added this
$myFeed->addConfig($config);  // Added this

while (FEEDS_BATCH_COMPLETE != $myFeed->import());

// ... some other code...

$myFeed = feeds_source('xml_second_importer');
$config = array('FeedsHTTPFetcher'=>array('source'=>$url_second));
$myFeed->addConfig($config);

$myFeed = NULL;  // Added this

$myFeed = feeds_source('xml_second_importer');  // Added this
$config = array('FeedsHTTPFetcher'=>array('source'=>$url_second));  // Added this
$myFeed->addConfig($config);  // Added this

while (FEEDS_BATCH_COMPLETE != $myFeed->import());

I'm not getting this error anymore!

Thanks to twistor pointing me out in the right direction in comment #5!

(Don't know if I should change the status to 'Needs Review' or something, so I just leave it.)

emilcarpenter’s picture

I still get errors at Cron run, even if it is not the line 577 error.

Posted debug info here: #3 http://drupal.org/node/1271502

emilcarpenter’s picture

Please disregard my #10 comment, it was as a noob dream :) that did not have any effect.

What had effect was ticking the checkbox "Allow source configuration override".

Why I thought the #10 code had effect, was that I probably checked the checkbox the same time I made the above changes. Why I thought using different importer invoke the 577-error was that I probably had the checkbox unchecked at times for some of my importers.

I was using the checkbox just for the changes for the XPath Parser to take effect when saving and did not think of its real meaning.

(I am importing programmatically, so I have no idea why/how this error would be triggered by manual import as stated by #9, steinmb.)

For me this issue is closed, but being a noob, I let the more experienced users to set the Status of this thread. Hope I'm right this time...

timb’s picture

Glad I ran across this post. I have a Feed Crawler that looked like it should run fine but just wouldn't, ending in this issue's error. Rebuilding from the ground up solved all the problems.

theunraveler’s picture

It looks to me like the method FeedSource::getConfigFor() only has Fetcher plugins available to it; that's what the method name would indicate to me as well. So, I'm not sure if it makes sense for a Parser plugin to be trying to get its config from the Fetcher object.

So here's a patch that just removes that call entirely. Since $source_config is set later on in the function, the object should be getting everything it needs from self::getConfig().

theunraveler’s picture

Actually, now that I think about it more, it looks like the object is trying to get its own config from the FeedsSource. Unless I'm missing something, this seems really unnecessary. This patch just does some cleanup now that I'm pretty sure this is the case.

steinmb’s picture

Status: Active » Needs review
twistor’s picture

Status: Needs review » Needs work

#15, The $source_config = $source->getConfigFor($this); is needed. There are two different places that configuration can exist.

  1. Importer configuration.
  2. Source configuration. I.e. the feed node.

What we're trying to do is allow configuration at the importer level, and allow users to override the values per feed node.

xjm’s picture

I'm getting a similar error with the FeedsJSONPath parser module when I call feeds_source('feed_name', $node->nid)->startImport(), and there are also issues posted for the same issue in other parser modules. I suspect either all these parsers will need the same fix, or perhaps there's something to be fixed in the base class in feeds itself?

pefferen’s picture

#13 Worked for me, thanks. but only when updating feeds_crawler to feeds_crawler-7.x-1.x-dev. instead of feeds_crawler-7.x-1.x-beta-1.

The patch provided in comment #15 did not seem to yield in changes in my use case, as far as I can tell. It might be needed in others, so I left it out and am back on feeds_crawler-7.x-1.x-dev again.

Though switching versions of feeds crawler seems to break the importers, which i made using the feeds crawler. It might be some setting it save to db.

gouky10’s picture

In my case:
I had $value['año'] and I could no get the value so I put $value[utf8_encode('año')] and IT SOLVE MY PROBLEM.
Thank you

slefevre1’s picture

I'm having this problem also. Is it perhaps because the feeds_xpathparser module doesn't properly set a config for itself?

slefevre1’s picture

I haven't tried the patch yet -- yesterday after some playing around, the issue seems to have resolved itself. I am doing debugging prints of the keys for $config in the FeedsSource object, and now a key for FeedsXPathParserXML exists (the array doesn't appear to have any values, but I'm not getting any errors and data is coming in).

I haven't isolated it, but it the config key seems not to be generating immediately upon specifying to feeds that you want to use xpath_parser. But what seems to have triggered the generation of the key is setting some of the mappings and xpath queries.

twistor’s picture

Assigned: twistor » Unassigned
Status: Needs work » Closed (duplicate)
twistor’s picture

Issue summary: View changes

clarity